-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mohsen Davoodi
authored and
Mohsen Davoodi
committed
Aug 1, 2022
1 parent
4649dc4
commit ddba570
Showing
10 changed files
with
183 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
export { black } from './black'; | ||
export { blue } from './blue'; | ||
export { common } from './common'; | ||
export { coolGrey } from './coolGrey'; | ||
export { green } from './green'; | ||
export { grey } from './grey'; | ||
export { magenta } from './magenta'; | ||
export { orange } from './orange'; | ||
export { defaultPalette } from './palette'; | ||
export { purple } from './purple'; | ||
export { red } from './red'; | ||
export { teal } from './teal'; | ||
export { turquoise } from './turquoise'; | ||
export { violet } from './violet'; | ||
export { warmGrey } from './warmGrey'; | ||
export { white } from './white'; | ||
export { yellow } from './yellow'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
export const defaultPalette = { | ||
primary: '#006FFF', | ||
secondary: '#FDB913', | ||
positive: '#42BE65', | ||
negative: '#FA4D56', | ||
success: '#42BE65', | ||
error: '#FA4D56', | ||
warning: '#FFC107', | ||
disable: '#DDE1E6', | ||
textPrimary: '#161616', | ||
textSecondary: '#393939', | ||
textLight: '#F4F4F4', | ||
textDisabled: '#A8A8A8', | ||
textPlaceholder: '#393939', | ||
textLink: '#006FFF', | ||
}; | ||
text: { | ||
primary: '#161616', | ||
secondary: '#393939', | ||
light: '#F4F4F4', | ||
disabled: '#A8A8A8', | ||
placeholder: '#393939', | ||
link: '#006FFF', | ||
}, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './colors'; | ||
export * from './mui'; | ||
export * from './styles'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Re-export all files from `@mui/material/styles` except the `createTheme` file | ||
*/ | ||
export { | ||
alpha, | ||
createStyles, | ||
css, | ||
darken, | ||
decomposeColor, | ||
duration, | ||
easing, | ||
emphasize, | ||
getContrastRatio, | ||
getInitColorSchemeScript, | ||
getLuminance, | ||
hexToRgb, | ||
hslToRgb, | ||
keyframes, | ||
lighten, | ||
makeStyles, | ||
recomposeColor, | ||
responsiveFontSizes, | ||
rgbToHex, | ||
shouldSkipGeneratingVar, | ||
styled, | ||
StyledEngineProvider, | ||
ThemeProvider, | ||
useColorScheme, | ||
useTheme, | ||
useThemeProps, | ||
withStyles, | ||
withTheme, | ||
} from '@mui/material/styles'; |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,43 @@ | ||
import { common as expectedCommon, defaultPalette } from '../colors'; | ||
import { createTheme } from './createTheme'; | ||
|
||
const { text: expectedText, disable: expectedDisabled, ...expectedSemantic } = defaultPalette; | ||
const isSemantic = (val: string): val is keyof typeof expectedSemantic => val in expectedSemantic; | ||
|
||
describe('createTheme', () => { | ||
it('should return default theme with no options', () => { | ||
const theme = createTheme(); | ||
console.log(theme.palette); | ||
expect(1).toBe(1); | ||
it('should return default palette when passing no options', () => { | ||
const { palette } = createTheme(); | ||
|
||
expect(palette.disabled).toBe(expectedDisabled); | ||
expect(palette.common).toMatchObject(expectedCommon); | ||
expect(palette.text).toMatchObject(expectedText); | ||
|
||
for (const [key, expected] of Object.entries(expectedSemantic)) { | ||
if (isSemantic(key)) { | ||
expect(palette[key].main).toBe(expected); | ||
} | ||
} | ||
}); | ||
|
||
it.each<keyof typeof expectedSemantic>(['primary', 'secondary', 'success', 'error', 'warning'])( | ||
'should return the given value when passing the options', | ||
(name) => { | ||
const sample = '#000'; | ||
const { palette } = createTheme({ | ||
palette: { | ||
[name]: { | ||
main: sample, | ||
}, | ||
}, | ||
}); | ||
|
||
expect(palette[name].main).toBe(sample); | ||
|
||
for (const [key, expected] of Object.entries(expectedSemantic)) { | ||
if (isSemantic(key) && key !== name) { | ||
expect(palette[key].main).toBe(expected); | ||
} | ||
} | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './createTheme'; |