Skip to content

Commit 7a53c92

Browse files
committed
fix: catalog dialogue font family issue
Signed-off-by: Amit Amrutiya <amitamrutiya2210@gmail.com>
1 parent 76af5dc commit 7a53c92

5 files changed

Lines changed: 30 additions & 24 deletions

File tree

src/custom/CatalogFilterSection/CatalogFilterSidebar.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ export interface CatalogFilterSidebarProps {
3838
setData: (callback: (prevFilters: FilterValues) => FilterValues) => void;
3939
lists: FilterList[];
4040
value?: FilterValues;
41+
styleProps?: StyleProps;
4142
}
4243

4344
export type FilterValues = Record<string, string | string[]>;
4445

4546
export interface StyleProps {
4647
backgroundColor?: string;
4748
sectionTitleBackgroundColor?: string;
49+
fontFamily?: string;
4850
}
4951

5052
/**
@@ -57,7 +59,8 @@ export interface StyleProps {
5759
const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
5860
lists,
5961
setData,
60-
value = {}
62+
value = {},
63+
styleProps
6164
}) => {
6265
const theme = useTheme(); // Get the current theme
6366
const [openDrawer, setOpenDrawer] = useState<boolean>(false);
@@ -70,23 +73,29 @@ const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
7073
setOpenDrawer(false);
7174
}, []);
7275

73-
const styleProps: StyleProps = {
76+
const defaultStyleProps: StyleProps = {
7477
backgroundColor:
7578
theme.palette.mode === 'light'
7679
? theme.palette.background.default
7780
: theme.palette.background.secondary,
7881
sectionTitleBackgroundColor:
79-
theme.palette.mode === 'light' ? theme.palette.background.surfaces : darkTeal.main
82+
theme.palette.mode === 'light' ? theme.palette.background.surfaces : darkTeal.main,
83+
fontFamily: theme.typography.fontFamily
84+
};
85+
86+
const appliedStyleProps = {
87+
...defaultStyleProps,
88+
...styleProps
8089
};
8190

8291
return (
8392
<>
84-
<FiltersCardDiv styleProps={styleProps}>
93+
<FiltersCardDiv styleProps={appliedStyleProps}>
8594
<CatalogFilterSidebarState
8695
lists={lists}
8796
onApplyFilters={setData}
8897
value={value}
89-
styleProps={styleProps}
98+
styleProps={appliedStyleProps}
9099
/>
91100
</FiltersCardDiv>
92101
<FilterDrawerDiv>
@@ -126,7 +135,7 @@ const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
126135
lists={lists}
127136
onApplyFilters={setData}
128137
value={value}
129-
styleProps={styleProps}
138+
styleProps={appliedStyleProps}
130139
/>
131140
</Box>
132141
<Box sx={{ backgroundColor: SLIGHT_BLUE, height: '5vh' }} />

src/custom/CatalogFilterSection/FilterSection.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ const FilterSection: React.FC<FilterSectionProps> = ({
5555
<>
5656
<FilterTitleButton
5757
onClick={() => onSectionToggle(filterKey)}
58-
style={{ backgroundColor: styleProps.sectionTitleBackgroundColor }}
58+
style={{
59+
backgroundColor: styleProps.sectionTitleBackgroundColor
60+
}}
5961
>
60-
<Typography variant="h6" fontWeight="bold">
62+
<Typography variant="h6" fontWeight="bold" fontFamily={styleProps.fontFamily}>
6163
{(sectionDisplayName || filterKey).toUpperCase()}
6264
</Typography>
6365
{openSections[filterKey] ? <ExpandLessIcon /> : <ExpandMoreIcon />}
@@ -105,7 +107,7 @@ const FilterSection: React.FC<FilterSectionProps> = ({
105107

106108
{option.Icon && <option.Icon width="20px" height="20px" />}
107109

108-
<Typography>{option.label}</Typography>
110+
<Typography fontFamily={styleProps.fontFamily}>{option.label}</Typography>
109111
</Stack>
110112
<Stack direction="row" alignItems="center" gap="0.35rem">
111113
{option.totalCount !== undefined && `(${option.totalCount || 0})`}

src/custom/CatalogFilterSection/style.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const FiltersCardDiv = styled(Box)<{ styleProps: StyleProps }>(({ stylePr
1515
backgroundColor: styleProps.backgroundColor,
1616
['@media (max-width:900px)']: {
1717
display: 'none'
18-
}
18+
},
19+
fontFamily: styleProps.fontFamily
1920
}));
2021

2122
export const FilterDrawerDiv = styled('div')(() => ({

src/custom/CustomCatalog/custom-card.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,7 @@ const CustomCatalogCard: React.FC<CatalogCardProps> = ({
190190
<>
191191
<ClassWrap catalogClassName={pattern?.catalog_data?.content_class ?? ''} />
192192
<DesignType>{patternType}</DesignType>
193-
194-
<DesignName
195-
style={{
196-
color: '#000D12',
197-
margin: '3rem 0 1.59rem 0',
198-
textAlign: 'center'
199-
}}
200-
>
201-
{pattern.name}
202-
</DesignName>
193+
<DesignName>{pattern.name}</DesignName>
203194
</>
204195
)}
205196
<DesignDetailsDiv>

src/custom/CustomCatalog/style.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,23 @@ export const MetricsCount = styled('p')(({ theme }) => ({
134134
color: theme.palette.text.secondary,
135135
fontWeight: '600'
136136
}));
137-
export const DesignName = styled(Typography)(({ theme }) => ({
137+
export const DesignName = styled(Typography)(() => ({
138138
fontWeight: 'bold',
139139
textTransform: 'capitalize',
140-
color: theme.palette.text.default,
140+
color: '#000D12',
141141
fontSize: '1.125rem',
142142
marginTop: '2rem',
143-
padding: '0rem 1rem', // "0rem 1.5rem"
143+
padding: '0rem 1rem',
144144
position: 'relative',
145145
overflow: 'hidden',
146146
whiteSpace: 'nowrap',
147147
textOverflow: 'ellipsis',
148148
textAlign: 'center',
149-
width: '100%'
149+
width: '100%',
150+
margin: '3rem 0 1.59rem 0',
151+
fontFamily: 'inherit'
150152
}));
153+
151154
export const MetricsContainerFront = styled('div')<MetricsProps>(({ isDetailed }) => ({
152155
display: 'flex',
153156
justifyContent: 'space-around',

0 commit comments

Comments
 (0)