Skip to content

Commit

Permalink
fix: use theme spacing for container padding
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jul 5, 2023
1 parent 1961936 commit 45cc88f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/theme/components/MuiContainer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import spacing from '../spacing';
import Components, { getFlexStyleOverrides } from './_components';

const MuiContainer: Components['MuiContainer'] = {
Expand All @@ -7,9 +8,9 @@ const MuiContainer: Components['MuiContainer'] = {
styleOverrides: {
root: ({ ownerState }) => ({
...getFlexStyleOverrides(ownerState),
paddingLeft: '15px !important',
paddingRight: '15px !important',
padding: '25px'
paddingLeft: spacing(2, true),
paddingRight: spacing(2, true),
padding: spacing(3)
})
}
};
Expand Down
11 changes: 8 additions & 3 deletions src/theme/spacing.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const spacing = (factor: number): string => `${8 * factor}px`;

export default spacing;
export default function spacing(
factor: number,
important: boolean = false
): string {
let spacing = `${8 * factor}px`;
if (important) spacing += ' !important';
return spacing;
}

0 comments on commit 45cc88f

Please sign in to comment.