Skip to content

Commit a86627e

Browse files
Merge pull request #645 from sudhanshutech/toolbar/options
Add theming to toolbar options
2 parents 186a132 + 7776ad6 commit a86627e

4 files changed

Lines changed: 20 additions & 14 deletions

File tree

src/custom/CustomColumnVisibilityControl/CustomColumnVisibilityControl.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTheme } from '@mui/material';
12
import React from 'react';
23
import { Box } from '../../base/Box';
34
import { Card } from '../../base/Card';
@@ -30,6 +31,7 @@ export function CustomColumnVisibilityControl({
3031
}: CustomColumnVisibilityControlProps): JSX.Element {
3132
const [open, setOpen] = React.useState(false);
3233
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
34+
const theme = useTheme();
3335

3436
const handleOpen = (event: React.MouseEvent<HTMLElement>) => {
3537
setAnchorEl(event.currentTarget);
@@ -54,7 +56,7 @@ export function CustomColumnVisibilityControl({
5456
<TooltipIcon
5557
title="View Columns"
5658
onClick={handleOpen}
57-
icon={<ColumnIcon fill="#3c494f" />}
59+
icon={<ColumnIcon fill={theme.palette.icon.default} />}
5860
arrow
5961
/>
6062
<PopperListener
@@ -87,7 +89,7 @@ export function CustomColumnVisibilityControl({
8789
flexDirection: 'column',
8890
padding: '1rem',
8991
boxShadow: open ? '0px 4px 8px rgba(0, 0, 0, 0.2)' : 'none',
90-
background: '#f4f5f7'
92+
background: theme.palette.background.surfaces
9193
}}
9294
>
9395
{columns.map((col) => (

src/custom/SearchBar.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const customTheme = (theme: Theme) =>
1212
MuiTextField: {
1313
styleOverrides: {
1414
root: {
15-
'--TextField-brandBorderColor': 'rgba(0, 0, 0, 0.5)',
15+
'--TextField-brandBorderColor': theme.palette.border.strong,
1616
'--TextField-brandBorderHoverColor': theme.palette.background.graphics?.default,
1717
'--TextField-brandBorderFocusedColor': theme.palette.background.graphics?.default,
1818
'& label.Mui-focused': {
@@ -39,6 +39,7 @@ const customTheme = (theme: Theme) =>
3939
MuiInput: {
4040
styleOverrides: {
4141
root: {
42+
color: theme.palette.text.default,
4243
'&::before': {
4344
borderBottom: '2px solid var(--TextField-brandBorderColor)'
4445
},
@@ -61,21 +62,18 @@ export interface SearchBarProps {
6162
onClear?: () => void;
6263
expanded: boolean;
6364
setExpanded: (expanded: boolean) => void;
64-
iconFill?: string;
6565
}
6666

6767
function SearchBar({
6868
onSearch,
6969
placeholder,
7070
onClear,
7171
expanded,
72-
setExpanded,
73-
iconFill
72+
setExpanded
7473
}: SearchBarProps): JSX.Element {
7574
const [searchText, setSearchText] = React.useState('');
7675
const searchRef = React.useRef<HTMLInputElement | null>(null);
77-
78-
const outerTheme = useTheme();
76+
const theme = useTheme();
7977

8078
const handleSearchChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
8179
setSearchText(event.target.value);
@@ -123,7 +121,7 @@ function SearchBar({
123121
}}
124122
>
125123
<div>
126-
<ThemeProvider theme={customTheme(outerTheme)}>
124+
<ThemeProvider theme={customTheme(theme)}>
127125
<TextField
128126
variant="standard"
129127
value={searchText}
@@ -144,14 +142,14 @@ function SearchBar({
144142
<TooltipIcon
145143
title="Close"
146144
onClick={handleClearIconClick}
147-
icon={<CloseIcon fill={iconFill} />}
145+
icon={<CloseIcon fill={theme.palette.icon.default} />}
148146
arrow
149147
/>
150148
) : (
151149
<TooltipIcon
152150
title="Search"
153151
onClick={handleSearchIconClick}
154-
icon={<SearchIcon fill={iconFill} />}
152+
icon={<SearchIcon fill={theme.palette.icon.default} />}
155153
arrow
156154
/>
157155
)}

src/custom/UniversalFilter.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTheme } from '@mui/material';
12
import { SelectChangeEvent } from '@mui/material/Select';
23
import React from 'react';
34
import { Button } from '../base/Button';
@@ -36,6 +37,7 @@ function UniversalFilter({
3637
}: UniversalFilterProps): JSX.Element {
3738
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
3839
const [open, setOpen] = React.useState(false);
40+
const theme = useTheme();
3941

4042
const handleFilterChange = (event: React.ChangeEvent<{ value: string }>, columnName: string) => {
4143
const value = event.target.value;
@@ -70,7 +72,7 @@ function UniversalFilter({
7072
<TooltipIcon
7173
title="Filter"
7274
onClick={handleClick}
73-
icon={<FilterIcon fill="#3c494f" />}
75+
icon={<FilterIcon fill={theme.palette.icon.default} />}
7476
arrow
7577
/>
7678
<PopperListener
@@ -92,7 +94,7 @@ function UniversalFilter({
9294
padding: '1rem',
9395
paddingTop: '1.8rem',
9496
boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.1)',
95-
backgroundColor: '#f4f5f7'
97+
backgroundColor: theme.palette.background.surfaces
9698
}}
9799
>
98100
{Object.keys(filters).map((filterColumn) => {

src/theme/components/outlinedinput.modifier.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export const MuiOutlinedInput: Components<Theme>['MuiOutlinedInput'] = {
99
root: ({ theme }) => {
1010
const {
1111
palette: {
12-
background: { graphics, brand }
12+
background: { graphics, brand },
13+
border: { strong }
1314
},
1415
typography: { textB1Regular }
1516
} = theme;
@@ -26,6 +27,9 @@ export const MuiOutlinedInput: Components<Theme>['MuiOutlinedInput'] = {
2627
},
2728
'&:hover .MuiOutlinedInput-notchedOutline': {
2829
borderColor: brand?.default
30+
},
31+
'& .MuiOutlinedInput-notchedOutline': {
32+
borderColor: strong
2933
}
3034
};
3135
}

0 commit comments

Comments
 (0)