Skip to content

Commit e08a79f

Browse files
committed
chore: use token for all of the theme text
Signed-off-by: Amit Amrutiya <amitamrutiya2210@gmail.com>
1 parent 05fc890 commit e08a79f

3 files changed

Lines changed: 22 additions & 20 deletions

File tree

src/custom/CatalogFilterSection/CatalogFilterSidebar.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import FilterAltIcon from '@mui/icons-material/FilterAlt';
2+
import { useTheme } from '@mui/material/styles';
23
import { useCallback, useState } from 'react';
34
import { Box, Drawer, Typography } from '../../base';
45
import { CloseIcon } from '../../icons';
5-
import { CULTURED, DARK_SLATE_GRAY, WHITE } from '../../theme';
66
import { CloseBtn } from '../Modal';
77
import CatalogFilterSidebarState from './CatalogFilterSidebarState';
88
import {
@@ -50,13 +50,14 @@ export interface StyleProps {
5050
* @description A functional component that renders the filter sidebar.
5151
* @param {Array} value - The data to be filtered.
5252
* @param {Function} setData - A function to set the filtered data.
53-
* @param {Array} lists - An array of filter sections and it's options lists.
53+
* @param {Array} lists - An array of filter sections and its options lists.
5454
*/
5555
const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
5656
lists,
5757
setData,
5858
value = {}
5959
}) => {
60+
const theme = useTheme(); // Get the current theme
6061
const [openDrawer, setOpenDrawer] = useState<boolean>(false);
6162

6263
const handleDrawerOpen = useCallback(() => {
@@ -68,8 +69,8 @@ const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
6869
}, []);
6970

7071
const styleProps: StyleProps = {
71-
backgroundColor: WHITE,
72-
sectionTitleBackgroundColor: CULTURED
72+
backgroundColor: theme.palette.background.default,
73+
sectionTitleBackgroundColor: theme.palette.background.surfaces
7374
};
7475

7576
return (
@@ -84,14 +85,14 @@ const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
8485
</FiltersCardDiv>
8586
<FilterDrawerDiv>
8687
<FilterButton variant="contained" onClick={handleDrawerOpen}>
87-
<FilterAltIcon height="20" width="20" fill={WHITE} />
88+
<FilterAltIcon height="20" width="20" fill={theme.palette.text.default} />
8889
<FilterText>Filters</FilterText>
8990
</FilterButton>
9091

9192
<Drawer anchor="bottom" open={openDrawer} variant="temporary" onClose={handleDrawerClose}>
9293
<Box sx={{ overflowY: 'hidden', height: '90vh' }}>
9394
<FiltersDrawerHeader>
94-
<Typography variant="h6" sx={{ color: WHITE }} component="div">
95+
<Typography variant="h6" sx={{ color: theme.palette.text.default }} component="div">
9596
Filters
9697
</Typography>
9798
<CloseBtn onClick={handleDrawerClose}>
@@ -102,7 +103,7 @@ const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
102103
style={{
103104
height: '75vh',
104105
overflowY: 'auto',
105-
background: WHITE
106+
background: theme.palette.background.default
106107
}}
107108
>
108109
<CatalogFilterSidebarState
@@ -112,7 +113,8 @@ const CatalogFilterSidebar: React.FC<CatalogFilterSidebarProps> = ({
112113
styleProps={styleProps}
113114
/>
114115
</Box>
115-
<Box sx={{ backgroundColor: DARK_SLATE_GRAY, height: '5vh' }} />
116+
<Box sx={{ backgroundColor: theme.palette.border.strong, height: '5vh' }} />
117+
{/* Use theme-aware color */}
116118
</Box>
117119
</Drawer>
118120
</FilterDrawerDiv>

src/custom/CatalogFilterSection/CatalogFilterSidebarState.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
StyleProps
77
} from './CatalogFilterSidebar';
88
import FilterSection from './FilterSection';
9+
910
/**
1011
* @component CatalogFilterSidebarState
1112
* @description A functional component that manages the filter state.

src/custom/CatalogFilterSection/style.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { styled } from '@mui/material/styles';
22
import { Box, Button, InputAdornment, ListItemButton } from '../../base';
3-
import { CARIBBEAN_GREEN, CHINESE_SILVER, CULTURED, DARK_SLATE_GRAY, KEPPEL } from '../../theme';
43
import { StyleProps } from './CatalogFilterSidebar';
54

65
export const FiltersCardDiv = styled(Box)<{ styleProps: StyleProps }>(({ styleProps }) => ({
@@ -31,44 +30,44 @@ export const LabelDiv = styled('div')(() => ({
3130
alignItems: 'center'
3231
}));
3332

34-
export const FilterButton = styled(Button)(() => ({
35-
backgroundColor: KEPPEL,
33+
export const FilterButton = styled(Button)(({ theme }) => ({
34+
backgroundColor: theme.palette.primary.brand?.default,
3635
'&:hover': {
37-
backgroundColor: CARIBBEAN_GREEN
36+
backgroundColor: theme.palette.background.default
3837
},
3938
height: '3.5rem',
4039
['@media (max-width:450px)']: {
4140
minWidth: '0px'
4241
}
4342
}));
4443

45-
export const FiltersDrawerHeader = styled(Box)(() => ({
44+
export const FiltersDrawerHeader = styled(Box)(({ theme }) => ({
4645
display: 'flex',
4746
justifyContent: 'space-between',
4847
alignItems: 'center',
4948
padding: '0.5rem 1rem',
50-
backgroundColor: DARK_SLATE_GRAY,
49+
backgroundColor: theme.palette.border.strong,
5150
height: '10vh',
5251
boxShadow: '0px 4px 4px rgba(0, 179, 159, 0.4)',
5352
marginBottom: '0.625rem'
5453
}));
5554

56-
export const CheckBoxButton = styled(ListItemButton)(() => ({
55+
export const CheckBoxButton = styled(ListItemButton)(({ theme }) => ({
5756
padding: '0.25rem 2rem',
5857
borderBottom: '1px solid',
59-
borderBottomColor: CHINESE_SILVER
58+
borderBottomColor: theme.palette.text.disabled
6059
}));
6160

62-
export const FilterTitleButton = styled(ListItemButton)(() => ({
63-
backgroundColor: CULTURED,
61+
export const FilterTitleButton = styled(ListItemButton)(({ theme }) => ({
62+
backgroundColor: theme.palette.background.surfaces,
6463
borderRadius: '0.5rem',
6564
marginTop: 2,
6665
display: 'flex',
6766
justifyContent: 'space-between'
6867
}));
6968

70-
export const InputAdornmentEnd = styled(InputAdornment)(() => ({
71-
borderLeft: `1px solid ${CHINESE_SILVER}`,
69+
export const InputAdornmentEnd = styled(InputAdornment)(({ theme }) => ({
70+
borderLeft: `1px solid ${theme.palette.text.disabled}`,
7271
height: '30px',
7372
paddingLeft: '10px',
7473
'@media (max-width: 590px)': {

0 commit comments

Comments
 (0)