Skip to content

Commit 787da12

Browse files
committed
Update readme
1 parent b29b913 commit 787da12

File tree

1 file changed

+30
-38
lines changed

1 file changed

+30
-38
lines changed

readme.md

+30-38
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
POC for bringing the principles of [https://styled-system.com/](https://styled-system.com/) to svelte.
66

77
This is for demo purposes only and not meant to be used yet!
8-
May change / be abondend any time.
8+
May change / be abandoned any time.
99

1010
Demo: [https://svelte.dev/repl/fd2a1151c14c4c2685ee55f661665204?version=3.17.1](https://svelte.dev/repl/fd2a1151c14c4c2685ee55f661665204?version=3.17.1)
1111

@@ -22,7 +22,7 @@ Demo: [https://svelte.dev/repl/fd2a1151c14c4c2685ee55f661665204?version=3.17.1](
2222

2323
### Defining your theme:
2424

25-
The theme definition is nothing more than a plain JS-Object wrapped in a writable store, that should contain an attribute `breakpoints: string[]` at the top level as a minimum config if you want to use responsive attributes.
25+
The theme definition is nothing more than a plain JS-Object wrapped in a writable store, that should contain an attribute `breakpoints: string[]` at the top level as a minimum config (if you want to use responsive attributes).
2626

2727
Besides that you can define all of your design variables just as you like.
2828

@@ -55,12 +55,12 @@ Using your theme is pretty straight forward, too. `styled` from `svelte-styled-s
5555
```jsx
5656
// Box.svelte
5757
<script>
58-
import { styled } from 'svelte-styled-system';
59-
import { theme } from './theme.js';
58+
import { styled } from 'svelte-styled-system';
59+
import { theme } from './theme.js';
6060
</script>
6161

6262
<div use:styled={[$$props, $theme]}>
63-
<slot></slot>
63+
<slot></slot>
6464
</div>
6565
```
6666

@@ -69,16 +69,16 @@ That's all! Your are ready to use all css property names + [shorthand](#currentl
6969
```jsx
7070
// App.svelte
7171
<script>
72-
import Box from './Box.svelte';
72+
import Box from './Box.svelte';
7373
</script>
7474

7575
<Box
76-
p={["space.s", "space.m", "space.l"]}
77-
bg="color.primary" color="color.secondary"
78-
textAlign="center"
76+
p={["space.s", "space.m", "space.l"]}
77+
bg="color.primary" color="color.secondary"
78+
textAlign="center"
7979
>
80-
<h3>Using styled-system in svelte!</h3>
81-
<p>Resize me to see my responsive padding in action</p>
80+
<h3>Using styled-system in svelte!</h3>
81+
<p>Resize me to see my responsive padding in action</p>
8282
</Box>
8383
```
8484

@@ -91,13 +91,13 @@ That's all! Your are ready to use all css property names + [shorthand](#currentl
9191

9292
```jsx
9393
{
94-
color: {
95-
primary: "dodgerblue", // path: color.primary
96-
},
97-
// path: scale.0 => 0
98-
// path: scale.1 => 0.5rem
99-
// path: scale.2 => 1rem
100-
scale: ["0", "0.5rem", "1rem"]
94+
color: {
95+
primary: "dodgerblue", // path: color.primary
96+
},
97+
// path: scale.0 => 0
98+
// path: scale.1 => 0.5rem
99+
// path: scale.2 => 1rem
100+
scale: ["0", "0.5rem", "1rem"]
101101
}
102102
```
103103

@@ -115,23 +115,15 @@ For commonly used css properties there are shortcuts to make your code _even les
115115
**Example:**
116116
`my="space.m"` => `margin-top: 1rem; margin-bottom: 1rem;`
117117

118-
As with all other properties you can use the responsive Array notation as well.
119-
120-
| name | properties |
121-
| ---- | --------------------------- |
122-
| bg | background-color |
123-
| size | width, height |
124-
| m | margin |
125-
| my | margin-top, margin-bottom |
126-
| mx | margin-left, margin-right |
127-
| mt | margin-top |
128-
| mr | margin-right |
129-
| mb | margin-bottom |
130-
| ml | margin-left |
131-
| p | padding |
132-
| py | padding-top, padding-bottom |
133-
| px | padding-left, padding-right |
134-
| pt | padding-top |
135-
| pr | padding-right |
136-
| pb | padding-bottom |
137-
| pl | padding-left |
118+
As with all other properties you can use the responsive Array notation as well!
119+
A complete list of shorthand props is available in the (chakra-ui docs)[https://chakra-ui.com/style-props] or at (src/constants.js)[src/constants.js]
120+
121+
**Note**: Shorthand path resolutions ("theme keys") are not supported yet. So you always have to specify the full object path:
122+
123+
```jsx
124+
// react styled-system:
125+
<MyComponent bg="primary" />
126+
127+
// svelte-styled-system:
128+
<MyComponent bg="color.primary" />
129+
```

0 commit comments

Comments
 (0)