Skip to content

Commit 3360bdf

Browse files
Sprinkles: Tweak example code (#76)
1 parent cea2bd9 commit 3360bdf

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

packages/sprinkles/README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,25 @@ Create an `atoms.css.ts` file, then configure and export your `atoms` function.
9090
import { createAtomicStyles, createAtomsFn } from '@vanilla-extract/sprinkles';
9191

9292
const space = {
93-
none: 0,
94-
small: 4,
95-
medium: 8,
96-
large: 16
97-
};
98-
99-
const colors = {
100-
blue50: '#eff6ff',
101-
blue100: '#dbeafe',
102-
blue200: '#bfdbfe',
93+
0: '0',
94+
4: '4px',
95+
8: '8px',
96+
12: '12px',
10397
// etc.
10498
};
10599

106-
const layoutStyles = createAtomicStyles({
100+
const responsiveStyles = createAtomicStyles({
107101
conditions: {
108102
mobile: {},
109103
tablet: { '@media': 'screen and (min-width: 768px)' },
110104
desktop: { '@media': 'screen and (min-width: 1024px)' }
111105
},
112106
defaultCondition: 'mobile',
113107
properties: {
114-
display: ['none', 'block', 'flex'],
108+
display: ['none', 'flex', 'block', 'inline'],
115109
flexDirection: ['row', 'column'],
110+
justifyContent: ['stretch', 'flex-start', 'center', 'flex-end', 'space-around', 'space-between'],
111+
alignItems: ['stretch', 'flex-start', 'center', 'flex-end'],
116112
paddingTop: space,
117113
paddingBottom: space,
118114
paddingLeft: space,
@@ -122,24 +118,32 @@ const layoutStyles = createAtomicStyles({
122118
shorthands: {
123119
padding: ['paddingTop', 'paddingBottom', 'paddingLeft', 'paddingRight'],
124120
paddingX: ['paddingLeft', 'paddingRight'],
125-
paddingY: ['paddingTop', 'paddingBottom']
121+
paddingY: ['paddingTop', 'paddingBottom'],
122+
placeItems: ['justifyContent', 'alignItems'],
126123
}
127124
});
128125

126+
const colors = {
127+
'blue-50': '#eff6ff',
128+
'blue-100': '#dbeafe',
129+
'blue-200': '#bfdbfe',
130+
// etc.
131+
};
132+
129133
const colorStyles = createAtomicStyles({
130134
conditions: {
131-
lightMode: { '@media': '(prefers-color-scheme: light)' },
135+
lightMode: {},
132136
darkMode: { '@media': '(prefers-color-scheme: dark)' }
133137
},
134-
defaultCondition: false,
138+
defaultCondition: 'lightMode',
135139
properties: {
136140
color: colors,
137141
background: colors,
138142
// etc.
139143
}
140144
});
141145

142-
export const atoms = createAtomsFn(layoutStyles, colorStyles);
146+
export const atoms = createAtomsFn(responsiveStyles, colorStyles);
143147
```
144148

145149
**🎉 That's it — you’re ready to go!**

0 commit comments

Comments
 (0)