forked from mui/material-ui
-
Couldn't load subscription status.
- 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
Open
mnajdova
wants to merge
23
commits into
origin/next
Choose a base branch
from
feat/utility-classes
base: origin/next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+691
−0
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
bfcf94b
init
mnajdova 5275938
added elevation
mnajdova 951a0d6
added texts
mnajdova 3f4157a
added displays
mnajdova 7ac50cb
prettier
mnajdova 5b18ea7
sr only
mnajdova fd3b51d
extracted component
mnajdova c8cb0a5
added positions
mnajdova 7846125
fixed wrong classname
mnajdova 7152ea8
updated color classes, updated spacing values
mnajdova f236b43
docs updates v1
mnajdova 0e6637d
added positions docs
mnajdova 925ebc3
docs updates
mnajdova 8ec1d98
added breakpoints, addressed comments
mnajdova 2b99ca1
Update docs/src/pages/system/global-classes/global-classes.md
mnajdova 9f6c026
addressed comments
mnajdova 9bd7de0
extracted to separate package
mnajdova 306d95e
prettier + formatted
mnajdova 5207018
prettier
mnajdova 9a45d26
fixes
mnajdova 3431773
fixes
mnajdova f2c98e0
fixed important
mnajdova 09bce37
prettier
mnajdova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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 }; | ||
| }; |
This file contains hidden or 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 hidden or 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,24 @@ | ||
| import * as React from 'react'; | ||
| import { GlobalCss } from '@material-ui/system'; | ||
| 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-1-5"> | ||
| <div className="m-4 p-2" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,24 @@ | ||
| import * as React from 'react'; | ||
| import { GlobalCss } from '@material-ui/system'; | ||
| 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-1-5"> | ||
| <div className="m-4 p-2" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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 @@ | ||
| 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> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 sm:bg-success-main sm:hover:bg-success-dark sm:text-success-contrastText md:bg-error-main md:hover:bg-error-dark md:text-error-contrastText lg:bg-warning-main lg:hover:bg-warning-dark lg:text-warning-contrastText" | ||
| > | ||
| Media | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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 @@ | ||
| 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> | ||
| <Button | ||
| variant="contained" | ||
| className="m-1 sm:bg-success-main sm:hover:bg-success-dark sm:text-success-contrastText md:bg-error-main md:hover:bg-error-dark md:text-error-contrastText lg:bg-warning-main lg:hover:bg-warning-dark lg:text-warning-contrastText" | ||
| > | ||
| Media | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,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 print:d-none p-2">Hidden when printed</div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,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 print:d-none p-2">Hidden when printed</div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,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> | ||
| ); | ||
| } |
21 changes: 21 additions & 0 deletions
21
docs/src/pages/system/global-classes/ElevationsExample.tsx
This file contains hidden or 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,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> | ||
| ); | ||
| } |
This file contains hidden or 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,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-10"> | ||
| <div className="position-absolute p-2 top-4 left-0 bg-grey-700 text-common-white"> | ||
| position-absolute | ||
| </div> | ||
| <div className="position-absolute py-2 px-6 top-9 left-5 zIndex-tooltip bg-primary-light text-common-white"> | ||
| zIndex-tooltip | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,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-10"> | ||
| <div className="position-absolute p-2 top-4 left-0 bg-grey-700 text-common-white"> | ||
| position-absolute | ||
| </div> | ||
| <div className="position-absolute py-2 px-6 top-9 left-5 zIndex-tooltip bg-primary-light text-common-white"> | ||
| zIndex-tooltip | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,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> | ||
| ); | ||
| } |
This file contains hidden or 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,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> | ||
| ); | ||
| } |
This file contains hidden or 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,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-0-5 p-1 typography-${val}`} key={val}> | ||
| Text {val} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
27 changes: 27 additions & 0 deletions
27
docs/src/pages/system/global-classes/TypographyExample.tsx
This file contains hidden or 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,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-0-5 p-1 typography-${val}`} key={val}> | ||
| Text {val} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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..