-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Box] Deprecate css prop in favor of sx (#23480)
- Loading branch information
1 parent
9a70c7d
commit 69f667b
Showing
22 changed files
with
241 additions
and
140 deletions.
There are no files selected for viewing
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
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,39 @@ | ||
import React from 'react'; | ||
import styled, { ThemeProvider } from 'styled-components'; | ||
import NoSsr from '@material-ui/core/NoSsr'; | ||
import { createMuiTheme } from '@material-ui/core/styles'; | ||
import { | ||
compose, | ||
spacing, | ||
palette, | ||
styleFunctionSx, | ||
SpacingProps, | ||
PaletteProps, | ||
} from '@material-ui/system'; | ||
import { CSSProperties } from '@material-ui/styles'; | ||
|
||
const styleFunction = styleFunctionSx(compose(spacing, palette)); | ||
|
||
type StyleFunctionProps = SpacingProps & PaletteProps & CSSProperties; | ||
|
||
type BoxProps = StyleFunctionProps & { | ||
sx?: StyleFunctionProps; | ||
// TODO: this should be removed once the css prop is dropped | ||
css?: StyleFunctionProps; | ||
}; | ||
|
||
const Box = styled.div<BoxProps>(styleFunction); | ||
|
||
const theme = createMuiTheme(); | ||
|
||
export default function CssProp() { | ||
return ( | ||
<NoSsr> | ||
<ThemeProvider theme={theme}> | ||
<Box color="white" sx={{ bgcolor: 'palevioletred', p: 1, textTransform: 'uppercase' }}> | ||
CssProp | ||
</Box> | ||
</ThemeProvider> | ||
</NoSsr> | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.
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
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.