Skip to content

Commit

Permalink
Add notes to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnblk committed Sep 11, 2019
1 parent ec73ace commit 8237993
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 5 deletions.
6 changes: 6 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Note from './src/note'

# Getting Started

Styled System is a collection of utility functions that add style props
Expand Down Expand Up @@ -145,8 +147,12 @@ The margin and padding props use a shorthand syntax, similar to
- `px` padding-left and padding-right
- `py` padding-top and padding-bottom

<Note>

Note: you can also use longform prop names (e.g. `margin`, `paddingTop`) if you prefer.

</Note>

### Space Theming

To set a consistent negative-space scale, add a `space` array to your theme.
Expand Down
10 changes: 7 additions & 3 deletions docs/src/gatsby-plugin-theme-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const colors = {
background: '#fff',
primary: '#00f',
secondary: '#00a',
highlight: '#c0f',
highlight: '#ededff',
accent: '#c0f',
gray: '#eee',
lightgray: '#fafafa',
midgray: '#777',
Expand All @@ -15,6 +16,7 @@ const colors = {
secondary: '#f0e',
gray: '#222',
lightgray: '#111',
highlight: '#001119',
},
cyan: {
text: '#023',
Expand All @@ -23,6 +25,7 @@ const colors = {
secondary: '#01a',
gray: '#0cc',
lightgray: '#0ee',
highlight: '#0de',
},
gray: {
text: '#eef',
Expand All @@ -31,6 +34,7 @@ const colors = {
secondary: '#0bf',
gray: '#55555a',
lightgray: '#444448',
highlight: '#33444c',
},
book: {
text: '#322',
Expand Down Expand Up @@ -65,10 +69,10 @@ const prism = {
color: 'secondary',
},
[['.selector', '.attr-name', '.string', '.char', '.builtin', '.inserted']]: {
color: 'highlight',
color: 'accent',
},
[['.operator', '.entity', '.url', '.string', '.variable']]: {
color: 'highlight',
color: 'accent',
},
[['.atrule', '.attr-value', '.function']]: {
color: 'primary',
Expand Down
19 changes: 19 additions & 0 deletions docs/src/note.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @jsx jsx */
import { jsx } from 'theme-ui'

export default props =>
<div
{...props}
sx={{
px: 3,
py: 2,
my: 3,
fontWeight: 'bold',
bg: 'highlight',
borderRadius: 2,
borderLeft: t => `4px solid ${t.colors.accent}`,
p: {
m: 0,
}
}}
/>
1 change: 1 addition & 0 deletions docs/src/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default props =>
components={components}
sx={{
pb: 4,
pr: 2,
ul: {
listStyle: 'none',
px: 0,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/sidebar.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- [Getting Started](/getting-started)
- [Responsive Styles](/responsive-styles)
- [How it Works](/how-it-works)
- [Custom Props](/custom-props)
- [Variants](/variants)
- [How it Works](/how-it-works)
- [API](/api)
- [Reference Table](/table)
- [Packages](/packages)
Expand Down
14 changes: 13 additions & 1 deletion docs/variants.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Note from './src/note'

# Variants

Use the variant API to apply complex styles to a component based on a single prop.
Expand All @@ -6,7 +8,11 @@ This can be a handy way to support slight stylistic variations in button or typo
Import the variant function and pass variant style objects in your component definition.
When defining variants inline, you can use Styled System like syntax to pick up values from your theme.

**Note**: Inline variants is a new feature in `v5.1.0`, which uses [@styled-system/css][].
<Note>

Note: Inline variants is a new feature in `v5.1.0`, which uses [@styled-system/css][].

</Note>

```js
// example Button with variants
Expand Down Expand Up @@ -40,6 +46,12 @@ The `Button` component can now use the `variant` prop to change between a primar
<Button variant='secondary'>Secondary</Button>
```

<Note>

Note: When using CSS properties in a variant, avoid mixing these styles with conflicting Styled System props. For example, if your variant includes the `color` property, avoid using the `color` React prop in your components.

</Note>

## Custom Prop Name

If you'd like to use a custom prop name other than `variant`, use the `prop` option.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"benchmark": "yarn workspace benchmarks test",
"cover": "yarn test --coverage",
"codecov": "yarn cover && npx codecov",
"start": "yarn workspace @styled-system/docs start",
"docs": "yarn workspace @styled-system/docs start",
"docs:build": "yarn workspace @styled-system/docs build",
"test": "jest"
Expand Down

0 comments on commit 8237993

Please sign in to comment.