Skip to content

Commit

Permalink
[docs] Box & system cleanup (#22962)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Oct 10, 2020
1 parent 01ebd98 commit 6c22660
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
9 changes: 3 additions & 6 deletions docs/src/pages/system/basics/Emotion.js
@@ -1,7 +1,6 @@
import * as React from 'react';
import styled from '@emotion/styled';
import { palette, spacing } from '@material-ui/system';
import NoSsr from '@material-ui/core/NoSsr';

const Box = styled.div`
${palette}
Expand All @@ -10,10 +9,8 @@ const Box = styled.div`

export default function Emotion() {
return (
<NoSsr>
<Box color="white" bgcolor="palevioletred" p={1}>
Emotion
</Box>
</NoSsr>
<Box color="white" bgcolor="palevioletred" p={1}>
Emotion
</Box>
);
}
9 changes: 3 additions & 6 deletions docs/src/pages/system/basics/Emotion.tsx
Expand Up @@ -6,7 +6,6 @@ import {
spacing,
SpacingProps,
} from '@material-ui/system';
import NoSsr from '@material-ui/core/NoSsr';

const Box = styled.div<PaletteProps & SpacingProps>`
${palette}
Expand All @@ -15,10 +14,8 @@ const Box = styled.div<PaletteProps & SpacingProps>`

export default function Emotion() {
return (
<NoSsr>
<Box color="white" bgcolor="palevioletred" p={1}>
Emotion
</Box>
</NoSsr>
<Box color="white" bgcolor="palevioletred" p={1}>
Emotion
</Box>
);
}
12 changes: 3 additions & 9 deletions docs/src/pages/system/basics/basics.md
Expand Up @@ -18,7 +18,7 @@ It's important to understand that this package exposes pure (side-effect free) s

### Demo

In the rest of this _Getting Started_ section we are using **styled-components** as the reference example (to emphasize the universality of this package). Alternatively, you can [use JSS](#interoperability).
In the rest of this _Getting Started_ section we are using **styled-components** as the reference example (to emphasize the universality of this package). Alternatively, you can [emotion](#interoperability) or any other CSS-in-JS styling solution.
The demos are also based on the **default** Material-UI [theme object](/customization/default-theme/).

{{"demo": "pages/system/basics/Demo.js", "defaultCodeOpen": true}}
Expand Down Expand Up @@ -110,21 +110,15 @@ To make the Box component more useful, we have been building a collection of sty
- [spacing](/system/spacing/#api)
- [typography](/system/typography/#api)

If you are already using `@material-ui/core`, you can use the [Box component](/components/box/) (using JSS internally):
If you are already using `@material-ui/core`, you can use the [Box component](/components/box/) (using emotion internally by default):

```jsx
import Box from '@material-ui/core/Box';
```

## Interoperability

`@material-ui/system` works with most CSS-in-JS libraries, including JSS, styled-components, and emotion.

If you are already using `@material-ui/core`, we encourage you to start with the **JSS** solution to minimize bundle size.

### JSS

{{"demo": "pages/system/basics/JSS.js", "defaultCodeOpen": true}}
`@material-ui/system` works with most CSS-in-JS libraries, including JSS, styled-components, and emotion. Here are a few examples usages.

### Styled components

Expand Down

0 comments on commit 6c22660

Please sign in to comment.