diff --git a/docs/public/static/images/system/demo.jpg b/docs/public/static/images/system/demo.jpg new file mode 100644 index 00000000000000..e6cb96a59aff64 Binary files /dev/null and b/docs/public/static/images/system/demo.jpg differ diff --git a/docs/src/pages/system/basics/Demo.js b/docs/src/pages/system/basics/Demo.js index 3a5fea248aa197..b8bbbdfca70e8a 100644 --- a/docs/src/pages/system/basics/Demo.js +++ b/docs/src/pages/system/basics/Demo.js @@ -1,162 +1,67 @@ import * as React from 'react'; -import PropTypes from 'prop-types'; import Box from '@material-ui/core/Box'; +import { alpha } from '@material-ui/core/styles'; +import ErrorIcon from '@material-ui/icons/Error'; -const CardHeader = (props) => { - const imgSize = [60, 90, 90, 120, 150]; +export default function Demo() { return ( - - - ); -}; - -CardHeader.propTypes = { - color: PropTypes.oneOf([ - 'error', - 'info', - 'primary', - 'secondary', - 'success', - 'warning', - ]), - sx: PropTypes.object, -}; - -const CardContent = (props) => { - return ( - - - {props.header} - - {props.description} + + 123 Main St, Pheonix AZ + + + $280,000 — $310,000 + + alpha(theme.palette.primary.main, 0.1), + borderRadius: '5px', + color: 'primary.main', + fontWeight: 'fontWeightMedium', + display: 'flex', + fontSize: 12, + alignItems: 'center', + '& svg': { + fontSize: 21, + mr: 0.5, + }, + }} + > + + {'CONFIDENCE SCORE 85%'} + ); -}; - -CardContent.propTypes = { - color: PropTypes.oneOf([ - 'error', - 'info', - 'primary', - 'secondary', - 'success', - 'warning', - ]), - description: PropTypes.string, - header: PropTypes.string, - sx: PropTypes.object, -}; - -const Card = (props) => { - const { - color = 'primary', - profileImage, - header, - description, - sx, - ...rest - } = props; - return ( - - - - - ); -}; - -Card.propTypes = { - color: PropTypes.oneOf([ - 'error', - 'info', - 'primary', - 'secondary', - 'success', - 'warning', - ]), - description: PropTypes.string.isRequired, - header: PropTypes.string, - profileImage: PropTypes.string, - sx: PropTypes.object, -}; +} -export default function Demo() { - return ( - - ); +function Img(props) { + return ; } diff --git a/docs/src/pages/system/basics/Demo.tsx b/docs/src/pages/system/basics/Demo.tsx index 9dbcb06b48bc88..d8c20d2ccdfc49 100644 --- a/docs/src/pages/system/basics/Demo.tsx +++ b/docs/src/pages/system/basics/Demo.tsx @@ -1,144 +1,72 @@ import * as React from 'react'; -import Box, { SxProps } from '@material-ui/core/Box'; +import Box, { BoxProps } from '@material-ui/core/Box'; +import { alpha } from '@material-ui/core/styles'; +import ErrorIcon from '@material-ui/icons/Error'; -type Color = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'; - -interface CardHeaderProps { - color?: Color; - sx?: SxProps; - src?: string; - alt?: string; -} - -const CardHeader: React.FC = (props) => { - const imgSize = [60, 90, 90, 120, 150]; +export default function Demo() { return ( - - - ); -}; - -interface CardContentProps { - color?: Color; - header?: string; - description?: string; - sx?: SxProps; -} - -const CardContent: React.FC = (props) => { - return ( - - {props.header} - - - {props.description} + + 123 Main St, Pheonix AZ + + + $280,000 — $310,000 + + alpha(theme.palette.primary.main, 0.1), + borderRadius: '5px', + color: 'primary.main', + fontWeight: 'fontWeightMedium', + display: 'flex', + fontSize: 12, + alignItems: 'center', + '& svg': { + fontSize: 21, + mr: 0.5, + }, + }} + > + + {'CONFIDENCE SCORE 85%'} + ); -}; - -interface CardProps { - color?: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'; - header?: string; - description: string; - sx?: SxProps; - profileImage?: string; } -const Card: React.FC = (props) => { - const { - color = 'primary', - profileImage, - header, - description, - sx, - ...rest - } = props; - return ( - - - - - ); -}; +interface ImgProps extends BoxProps { + src?: string; + alt?: string; +} -export default function Demo() { - return ( - - ); +function Img(props: ImgProps) { + return ; } diff --git a/docs/src/pages/system/basics/basics.md b/docs/src/pages/system/basics/basics.md index e82f5e3d50b69e..cd8683cfd517db 100644 --- a/docs/src/pages/system/basics/basics.md +++ b/docs/src/pages/system/basics/basics.md @@ -6,7 +6,7 @@ The system lets you quickly build custom UI components leveraging the design tok ## Demo -{{"demo": "pages/system/basics/Demo.js"}} +{{"demo": "pages/system/basics/Demo.js", "bg": true, "defaultCodeOpen": true}} ## Why @@ -86,7 +86,7 @@ We offer lots of shorthands on the CSS properties. Here are few examples: ### Superset of CSS -As the property is a superset of CSS, you can use child or pseudo selectors, media queries, raw css values etc. On the example above, we had several examples of this. +As the property is a superset of CSS, you can use child or pseudo selectors, media queries, raw css values etc. Here are few examples: ```jsx // Using pseudo selectors @@ -94,10 +94,10 @@ As the property is a superset of CSS, you can use child or pseudo selectors, med sx={{ // some styles ":hover": { - '& .CardHeader': { + '& .ChildSelector': { bgcolor: `${props.color}.dark`, }, - '& .CardContent-header': { + '& .OtherChildSelector': { color: `${props.color}.dark`, }, boxShadow: 6,