Skip to content

Commit 5a50476

Browse files
committed
Edit docs
1 parent b142f90 commit 5a50476

File tree

5 files changed

+59
-15
lines changed

5 files changed

+59
-15
lines changed

packages/docs/src/components/banner.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,13 @@ export default props => (
66
theme={{
77
styles: {
88
p: {
9-
':first-of-type': {
10-
variant: 'text.display',
11-
fontSize: [3, null, 4],
12-
mt: 4,
13-
},
14-
fontWeight: 'bold',
15-
mt: 0,
16-
mb: 3,
9+
maxWidth: '40em',
10+
my: 4,
1711
},
1812
h1: {
1913
fontSize: [3, 3, 4],
20-
fontWeight: 'heading',
21-
letterSpacing: 'initial',
22-
mt: 0,
23-
mb: 4,
14+
letterSpacing: '0',
15+
my: 4,
2416
},
2517
a: {
2618
variant: 'links.button',

packages/docs/src/pages/getting-started/index.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export default props => (
5252
Use the `sx` prop throughout your application to add styles based on your theme to any component.
5353
Enable the `sx` prop by adding the `/** @jsx jsx */` comment to the top of your file and importing `jsx` from Theme UI.
5454

55+
The `sx` prop lets you add any valid CSS to an element,
56+
while using values from your theme to keep styles consistent.
57+
You can think of the style object that the `sx` prop accepts as a *superset* of CSS.
58+
5559

5660
```jsx
5761
/** @jsx jsx */
@@ -96,9 +100,23 @@ The values used for media queries can be defined in a [`theme.breakpoints`](/the
96100

97101
</Note>
98102

103+
If you prefer standard CSS syntax, you can use nested objects for responsive styles as well.
104+
105+
```jsx
106+
<div
107+
sx={{
108+
width: '100%',
109+
'@media screen and (min-width: 40em)': {
110+
width: '50%',
111+
}
112+
}}
113+
/>
114+
```
115+
99116
## Components
100117

101118
Theme UI includes a library of primitive UI components, which can be completely customized with your theme and include support for [variants](/components/variants).
119+
You can use variants to encapsulate more complex, component-specific styles that can be changed with props.
102120
Import and use these components to handle layout, images, forms, and more.
103121

104122
```jsx

packages/docs/src/pages/guides/object-styles.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ This also means that you can use JS math expressions to derive values.
4141
}
4242
```
4343

44+
To use other CSS units, use strings as values instead.
45+
46+
```js
47+
{
48+
fontSize: '2em',
49+
}
50+
```
51+
4452
## Commas
4553

4654
All properties should be separated by commas, not semicolons.

packages/docs/src/pages/index.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ import Hexo from '../components/hexo'
77

88
<Hexo />
99

10-
Theme UI
10+
# Theme UI: The Design Graph Framework
11+
12+
Theme UI is a library for creating themeable user interfaces based on constraint-based design principles.
13+
Build custom component libraries, design systems, web applications, Gatsby themes, and more
14+
with a flexible API for best-in-class developer ergonomics.
1115

12-
# Build themeable design systems based on constraint-based design principles
1316

1417
[Documentation](/getting-started)
1518
[GitHub](https://github.com/system-ui/theme-ui)

packages/docs/src/pages/sx-prop.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ title: 'The `sx` Prop'
88
The `sx` prop lets you style elements inline, using values from your theme.
99
To use the `sx` prop, add the custom `/** @jsx jsx */` pragma comment to the top of your module and import the `jsx` function.
1010

11+
The `sx` prop lets you add any valid CSS to an element,
12+
while using values from your theme to keep styles consistent.
13+
You can think of the style object that the `sx` prop accepts as a *superset* of CSS.
14+
1115
```jsx
1216
/** @jsx jsx */
1317
import { jsx } from 'theme-ui'
@@ -124,6 +128,21 @@ export default props => (
124128
)
125129
```
126130

131+
### Media Queries
132+
133+
If you prefer standard CSS media query syntax, you can use nested objects for responsive styles as well.
134+
135+
```jsx
136+
<div
137+
sx={{
138+
width: '100%',
139+
'@media screen and (min-width: 40em)': {
140+
width: '50%',
141+
}
142+
}}
143+
/>
144+
```
145+
127146
## Margin and Padding
128147

129148
Margin and padding are treated as first-class citizens in Theme UI,
@@ -167,7 +186,7 @@ export default props => (
167186
In some cases you might want to apply styles to children of the current element.
168187
You can do so with Emotion's [nested selectors](https://emotion.sh/docs/nested).
169188

170-
If you want to reference the current class of the component, you can use the [`&`](https://emotion.sh/docs/object-styles#child-selectors) symbol.
189+
If you want to reference the current class selector of the component, you can use the [`&`](https://emotion.sh/docs/object-styles#child-selectors) symbol.
171190

172191
```jsx
173192
/** @jsx jsx */
@@ -230,3 +249,7 @@ import { Box } from 'theme-ui'
230249
</Box>
231250
```
232251

252+
## Object Styles
253+
254+
If you're new to using JavaScript object notation for authoring styles, see the [guide to using objects for styling](/guides/object-styles).
255+

0 commit comments

Comments
 (0)