-
Notifications
You must be signed in to change notification settings - Fork 2
Utility classes #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: origin/next
Are you sure you want to change the base?
Changes from 13 commits
bfcf94b
5275938
951a0d6
3f4157a
7ac50cb
5b18ea7
fd3b51d
c8cb0a5
7846125
7152ea8
f236b43
0e6637d
925ebc3
8ec1d98
2b99ca1
9f6c026
9bd7de0
306d95e
5207018
9a45d26
3431773
f2c98e0
09bce37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import React from 'react'; | ||
| import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
| import { prepareMarkdown } from 'docs/src/modules/utils/parseMarkdown'; | ||
|
|
||
| const pageFilename = 'system/global-classes'; | ||
| const requireDemo = require.context('docs/src/pages/system/global-classes', false, /\.(js|tsx)$/); | ||
| const requireRaw = require.context( | ||
| '!raw-loader!../../src/pages/system/global-classes', | ||
| false, | ||
| /\.(js|md|tsx)$/, | ||
| ); | ||
|
|
||
| export default function Page({ demos, docs }) { | ||
| return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />; | ||
| } | ||
|
|
||
| Page.getInitialProps = () => { | ||
| const { demos, docs } = prepareMarkdown({ pageFilename, requireRaw }); | ||
| return { demos, docs }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import * as React from 'react'; | ||
| import GlobalCss from './GlobalCss'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& *': { | ||
| border: '1px dashed grey', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <div className={classes.debug}> | ||
| <GlobalCss /> | ||
| <div className="m-2 p-4"> | ||
| <div className="m-4 p-2"></div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import * as React from 'react'; | ||
| import GlobalCss from './GlobalCss'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& *': { | ||
| border: '1px dashed grey', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <div className={classes.debug}> | ||
| <GlobalCss /> | ||
| <div className="m-2 p-4"> | ||
| <div className="m-4 p-2"></div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import * as React from 'react'; | ||
| import Button from '@material-ui/core/Button'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 bg-warning-main hover-bg-warning-dark text-warning-contrastText" | ||
| > | ||
| Warning | ||
| </Button> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 bg-error-main hover-bg-error-dark text-error-contrastText" | ||
| > | ||
| Error | ||
| </Button> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 bg-success-main hover-bg-success-dark text-success-contrastText" | ||
| > | ||
| Success | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import * as React from 'react'; | ||
| import Button from '@material-ui/core/Button'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 bg-warning-main hover-bg-warning-dark text-warning-contrastText" | ||
| > | ||
| Warning | ||
| </Button> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 bg-error-main hover-bg-error-dark text-error-contrastText" | ||
| > | ||
| Error | ||
| </Button> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 bg-success-main hover-bg-success-dark text-success-contrastText" | ||
| > | ||
| Success | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& *': { | ||
| border: '1px dashed grey', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
| return ( | ||
| <div className={classes.debug}> | ||
| <div className="d-inline mr-1 p-2">div.d-inline</div> | ||
| <div className="d-inline d-print-none p-2">Hidden when printed</div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& *': { | ||
| border: '1px dashed grey', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
| return ( | ||
| <div className={classes.debug}> | ||
| <div className="d-inline mr-1 p-2">div.d-inline</div> | ||
| <div className="d-inline d-print-none p-2">Hidden when printed</div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& > *': { border: '1px dashed grey' }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
| return ( | ||
| <div className={classes.debug}> | ||
| {Array.from(Array(24).keys()).map((val) => ( | ||
| <div className={`m-2 p-1 elevation-${val}`} key={val}> | ||
| Elevation {val} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& > *': { border: '1px dashed grey' }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
| return ( | ||
| <div className={classes.debug}> | ||
| {Array.from(Array(24).keys()).map((val) => ( | ||
| <div className={`m-2 p-1 elevation-${val}`} key={val}> | ||
| Elevation {val} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export default function (): JSX.Element; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { withStyles } from '@material-ui/styles'; | ||
| import spacings from './spacings'; | ||
| import colors from './colors'; | ||
| import elevations from './elevations'; | ||
| import texts from './texts'; | ||
| import positions from './positions'; | ||
| import { | ||
| displays, | ||
| overflows, | ||
| textOverflows, | ||
| visibilities, | ||
| whiteSpaces, | ||
| } from './displays'; | ||
|
|
||
| const GlobalCss = withStyles((theme) => { | ||
|
||
| return { | ||
| '@global': { | ||
| ...spacings(theme), | ||
| ...colors(theme), | ||
| ...elevations(theme), | ||
| ...texts(theme), | ||
| ...positions(theme), | ||
| ...displays, | ||
| ...overflows, | ||
| ...textOverflows, | ||
| ...visibilities, | ||
| ...whiteSpaces, | ||
| }, | ||
| }; | ||
| })(() => null); | ||
|
|
||
| export default GlobalCss; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| root: { width: '100%' }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <div className={classes.root}> | ||
| <div className="position-relative p-4 mb-14"> | ||
| <div className="position-absolute p-4 top-4 left-0 bg-grey-700 text-common-white"> | ||
| position-absolute | ||
| </div> | ||
| <div className="position-absolute py-4 px-6 top-10 left-5 zIndex-tooltip bg-primary-light text-common-white"> | ||
| zIndex-tooltip | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| root: { width: '100%' }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <div className={classes.root}> | ||
| <div className="position-relative p-4 mb-14"> | ||
| <div className="position-absolute p-4 top-4 left-0 bg-grey-700 text-common-white"> | ||
| position-absolute | ||
| </div> | ||
| <div className="position-absolute py-4 px-6 top-10 left-5 zIndex-tooltip bg-primary-light text-common-white"> | ||
| zIndex-tooltip | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& *': { border: '1px dashed grey' }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <div className={classes.debug}> | ||
| <div className="m-4 p-4"> | ||
| <div className="px-10 py-4"></div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import * as React from 'react'; | ||
| import { makeStyles } from '@material-ui/styles'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| debug: { | ||
| '& *': { border: '1px dashed grey' }, | ||
| }, | ||
| }); | ||
|
|
||
| export default function App() { | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <div className={classes.debug}> | ||
| <div className="m-4 p-4"> | ||
| <div className="px-10 py-4"></div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import * as React from 'react'; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div> | ||
| {[ | ||
| 'h1', | ||
| 'h2', | ||
| 'h3', | ||
| 'h4', | ||
| 'h5', | ||
| 'h6', | ||
| 'subtitle1', | ||
| 'subtitle2', | ||
| 'body1', | ||
| 'body2', | ||
| 'button', | ||
| 'caption', | ||
| 'overline', | ||
| ].map((val) => ( | ||
| <div className={`m-2 p-1 text-${val}`} key={val}> | ||
| Text {val} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing the structure makes me think of how we don't explain well the value proposition of the helpers on the
/basicspage. http://material-ui.com/system/basics#real-world-use-case should be at the top like they did on https://tailwindcss.com/docs/utility-first. Or even https://chakra-ui.com/ on the homepage 😆There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was missing explanation a bit too to be honest..