Skip to content

Commit ecb65c2

Browse files
Merge pull request #1374 from banana-three-join/bug/banana-three-join/feedback_modal_button
Fix: Styling Issue With Text
2 parents 77af82b + e092bf3 commit ecb65c2

2 files changed

Lines changed: 21 additions & 25 deletions

File tree

src/custom/Feedback/FeedbackButton.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Typography from '@mui/material/Typography';
2-
import React, { CSSProperties, useState } from 'react';
2+
import React, { CSSProperties, FC, useState } from 'react';
33
import {
44
CalenderIcon,
55
CloseIcon,
@@ -8,7 +8,8 @@ import {
88
QuestionIcon,
99
SuccessIcon
1010
} from '../../icons';
11-
import { CULTURED } from '../../theme';
11+
import { IconProps } from '../../icons/types';
12+
import { useTheme, CULTURED } from '../../theme';
1213
import { CustomTooltip } from '../CustomTooltip';
1314
import { ModalButtonPrimary } from '../Modal';
1415
import { ModalCard } from '../ModalCard';
@@ -35,7 +36,7 @@ const tooltipContent =
3536
'Some account and system information may be sent to Layer5. We will use it to fix problems and improve our services, subject to our [Privacy Policy](https://layer5.io/company/legal/privacy) and [Terms of Service](https://layer5.io/company/legal/terms-of-service). We may email you for more information or updates.';
3637

3738
interface FeedbackDataItem {
38-
icon: JSX.Element;
39+
icon: FC<IconProps>;
3940
label: string;
4041
placeholder?: string;
4142
isTextInput: boolean;
@@ -44,19 +45,19 @@ interface FeedbackDataItem {
4445

4546
const feedbackData: FeedbackDataItem[] = [
4647
{
47-
icon: <FeedbackIcon />,
48+
icon: FeedbackIcon,
4849
label: 'Issue',
4950
placeholder: 'I’m having an issue with...',
5051
isTextInput: true
5152
},
5253
{
53-
icon: <IdeaIcon />,
54+
icon: IdeaIcon,
5455
label: 'Suggestion',
5556
placeholder: 'I have a suggestion about...',
5657
isTextInput: true
5758
},
5859
{
59-
icon: <CalenderIcon />,
60+
icon: CalenderIcon,
6061
label: 'Meet Request',
6162
isTextInput: false,
6263
innerComponent: (
@@ -99,6 +100,7 @@ const FeedbackComponent: React.FC<FeedbackComponentProps> = ({
99100
defaultMessage = undefined,
100101
defaultOpen = false
101102
}) => {
103+
const theme = useTheme();
102104
const [isOpen, setIsOpen] = useState<boolean>(defaultOpen);
103105
const [submitted, setSubmitted] = useState<boolean>(false);
104106
const [category, setCategory] = useState<FeedbackDataItem | undefined>(feedbackData[0]);
@@ -190,18 +192,18 @@ const FeedbackComponent: React.FC<FeedbackComponentProps> = ({
190192
<FeedbackForm>
191193
<FeedbackOptions>
192194
{feedbackData?.map((item) => (
193-
<FeedbackOptionButton
194-
key={item.label}
195-
style={feedbackOptionStyles}
196-
type="button"
197-
onClick={() => {
198-
setCategory(item);
199-
}}
200-
isOpen={category?.label === item.label}
201-
>
202-
<FeedbackMiniIcon>{item.icon}</FeedbackMiniIcon>
203-
<Typography>{item.label}</Typography>
204-
</FeedbackOptionButton>
195+
<FeedbackOptionButton
196+
key={item.label}
197+
style={feedbackOptionStyles}
198+
type="button"
199+
onClick={() => {
200+
setCategory(item);
201+
}}
202+
isOpen={category?.label === item.label}
203+
>
204+
<FeedbackMiniIcon><item.icon fill={category?.label === item.label ? theme.palette.icon.default : undefined}/></FeedbackMiniIcon>
205+
<Typography>{item.label}</Typography>
206+
</FeedbackOptionButton>
205207
))}
206208
</FeedbackOptions>
207209
{category?.isTextInput ? (

src/custom/Feedback/style.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,7 @@ export const FeedbackOptionButton = styled(Button)<FeedbackMessageProps>(({ them
250250
flexDirection: 'column',
251251
borderBottom: isOpen ? `2px solid ${theme.palette.interactive.primary}` : '',
252252
background: isOpen ? SNOW_WHITE : theme.palette.navigation.secondary,
253-
color: isOpen
254-
? theme.palette.mode === 'dark'
255-
? SNOW_WHITE
256-
: BLACK
257-
: theme.palette.mode === 'dark'
258-
? SNOW_WHITE
259-
: SNOW_WHITE,
253+
color: isOpen ? BLACK : SNOW_WHITE,
260254
fill: isOpen ? theme.palette.icon.default : SNOW_WHITE,
261255
stroke: isOpen ? theme.palette.icon.inverse : theme.palette.icon.brand,
262256
'&:hover': {

0 commit comments

Comments
 (0)