Skip to content

Commit d5443d7

Browse files
author
Nika Kolesnikova
committed
remove exported custom styles into a MUIStyles.js
1 parent d6e08d8 commit d5443d7

File tree

12 files changed

+59
-50
lines changed

12 files changed

+59
-50
lines changed

src/App.jsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,6 @@ import { useShoppingLists } from './api';
88
import { ToastContainer } from 'react-toastify';
99
import 'react-toastify/dist/ReactToastify.css';
1010

11-
const paperStyle = {
12-
color: 'white',
13-
p: '1rem',
14-
};
15-
16-
export const darkPaperStyle = {
17-
...paperStyle,
18-
paddingBlockStart: '4rem',
19-
paddingBlockEnd: '4rem',
20-
background: `linear-gradient(45deg, rgba(117, 124, 232, 0.2) 0%, rgba(117, 124, 232, 0.05) 100%)`, // Pale blue gradient on top
21-
backdropFilter: 'blur(2px)',
22-
};
23-
24-
export const lightPaperStyle = {
25-
...paperStyle,
26-
background: `rgba(117, 124, 232, 0.2)`,
27-
};
28-
2911
export function App() {
3012
/**
3113
* This custom hook takes the path of a shopping list

src/components/AddItems.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { normalizeItemName } from '../utils';
55
import { RadioInputElement, TextInputElement } from './index.js';
66
import { toast } from 'react-toastify';
77
import { Box, Button, FormControl, RadioGroup } from '@mui/material';
8-
import { buttonStyle } from '../views';
8+
import { buttonStyle } from './index';
99

1010
const radioGroupStyle = {
1111
mx: 1,

src/components/ConfirmDialog.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Button,
99
} from '@mui/material';
1010
import CloseIcon from '@mui/icons-material/Close';
11-
import { buttonStyle } from '../views';
11+
import { buttonStyle } from './index';
1212
import './ConfirmDialog.css';
1313

1414
// MUI's Dialog already comes with built-in focus management and accessibility features.
@@ -23,11 +23,6 @@ const dialogStyle = {
2323
backgroundColor: 'rgb(20, 20, 20)',
2424
};
2525

26-
export const typographyStyle = {
27-
padding: '1em',
28-
color: 'white',
29-
};
30-
3126
export function ConfirmDialog({ props }) {
3227
const { handleDelete, title, setOpen, open } = props;
3328

src/components/DeleteIconWithTooltip.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { DeleteOutlineOutlined } from '@mui/icons-material';
22
import { Tooltip, IconButton } from '@mui/material';
3-
4-
export const tooltipStyle = {
5-
fontSize: '1.5rem',
6-
marginBlockStart: '0',
7-
marginBlockEnd: '0',
8-
};
3+
import { tooltipStyle } from './MUIStyles';
94

105
export const DeleteIconWithTooltip = ({ ariaLabel, toggleDialog }) => {
116
return (

src/components/ListItem.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { updateItem, deleteItem } from '../api';
33
import { calculateDateNextPurchased, ONE_DAY_IN_MILLISECONDS } from '../utils';
44
import { toast } from 'react-toastify';
55
import { useConfirmDialog } from '../hooks/useConfirmDialog';
6-
import { DeleteIconWithTooltip, tooltipStyle, ConfirmDialog } from './index';
6+
import { DeleteIconWithTooltip, ConfirmDialog, tooltipStyle } from './index';
77
import {
88
ListItem as MaterialListItem,
99
Tooltip,

src/components/MUIStyles.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const paperStyle = {
2+
color: 'white',
3+
p: '1rem',
4+
};
5+
6+
export const darkPaperStyle = {
7+
...paperStyle,
8+
paddingBlockStart: '4rem',
9+
paddingBlockEnd: '4rem',
10+
background: `linear-gradient(45deg, rgba(117, 124, 232, 0.2) 0%, rgba(117, 124, 232, 0.05) 100%)`, // Pale blue gradient on top
11+
backdropFilter: 'blur(2px)',
12+
};
13+
14+
export const lightPaperStyle = {
15+
...paperStyle,
16+
background: `rgba(117, 124, 232, 0.2)`,
17+
};
18+
19+
export const tooltipStyle = {
20+
fontSize: '1.5rem',
21+
marginBlockStart: '0',
22+
marginBlockEnd: '0',
23+
};
24+
25+
export const buttonStyle = {
26+
color: 'white',
27+
fontSize: '1.5rem',
28+
};
29+
30+
export const buttonWithTopMarginStyle = {
31+
...buttonStyle,
32+
marginTop: '0.5rem',
33+
};
34+
35+
export const typographyStyle = {
36+
padding: '1em',
37+
color: 'white',
38+
};

src/components/RadioInputElement.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Radio, Tooltip, FormControlLabel } from '@mui/material';
2-
import { tooltipStyle } from './DeleteIconWithTooltip';
2+
import { tooltipStyle } from './MUIStyles';
33

44
const radioStyle = {
55
color: 'white',

src/components/ShareList.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { useStateWithStorage, useAuth } from '../hooks';
22
import { shareList } from '../api';
33
import { toast } from 'react-toastify';
44
import { Box, Button } from '@mui/material';
5-
import { TextInputElement } from './index.js';
6-
import { buttonWithTopMarginStyle } from '../views/Home';
5+
import { TextInputElement, buttonWithTopMarginStyle } from './index.js';
76

87
export function ShareList() {
98
const [listPath] = useStateWithStorage('tcl-shopping-list-path', null);

src/components/TextInputElement.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TextField, Typography } from '@mui/material';
2-
import { typographyStyle } from './ConfirmDialog';
2+
import { typographyStyle } from '../components/index';
33

44
const textFieldStyle = {
55
'& .MuiInputBase-input': {

src/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export * from './TextInputElement';
66
export * from './RadioInputElement';
77
export * from './ConfirmDialog';
88
export * from './DeleteIconWithTooltip';
9+
export * from './MUIStyles';

0 commit comments

Comments
 (0)