-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[zero] Migrate to use wyw-in-js instead of linaria (#40866)
- Loading branch information
1 parent
af92b52
commit 2321cf6
Showing
22 changed files
with
285 additions
and
252 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
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,68 @@ | ||
import { generateAtomics } from '@mui/zero-runtime'; | ||
|
||
const atomics = generateAtomics(({ theme }) => ({ | ||
conditions: Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => { | ||
acc[breakpoint] = `@media (min-width: ${theme.breakpoints.values[breakpoint]}${ | ||
theme.breakpoints.unit ?? 'px' | ||
})`; | ||
return acc; | ||
}, {}), | ||
defaultCondition: 'xs', | ||
properties: { | ||
display: [ | ||
'block', | ||
'inline-flex', | ||
'contents', | ||
'none', | ||
'flex', | ||
'inline-flex', | ||
'grid', | ||
'inline-grid', | ||
], | ||
flexDirection: ['row', 'row-reverse', 'column', 'column-reverse'], | ||
justifyContent: [ | ||
'center', | ||
'end', | ||
'flex-end', | ||
'flex-start', | ||
'left', | ||
'right', | ||
'space-around', | ||
'space-between', | ||
'space-evenly', | ||
'start', | ||
], | ||
alignItems: [ | ||
'baseline', | ||
'center', | ||
'end', | ||
'flex-end', | ||
'flex-start', | ||
'self-end', | ||
'self-start', | ||
'start', | ||
'stretch', | ||
], | ||
position: ['relative', 'absolute', 'static', 'sticky', 'fixed'], | ||
}, | ||
shorthands: { | ||
direction: ['flexDirection'], | ||
}, | ||
})); | ||
|
||
// eslint-disable-next-line react/prop-types | ||
export function Box({ children, as = 'div', className = '', style = undefined, ...rest }) { | ||
const Component = as; | ||
const atomicsResult = atomics(rest); | ||
const componentClass = `${atomicsResult.className} ${className ?? ''}`.trim(); | ||
const finalStyles = { | ||
...(atomicsResult.style ?? {}), | ||
...style, | ||
}; | ||
return ( | ||
// eslint-disable-next-line react/jsx-filename-extension | ||
<Component className={componentClass} style={finalStyles}> | ||
{children} | ||
</Component> | ||
); | ||
} |
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
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
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
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
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
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
Oops, something went wrong.