-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsided.mjs
36 lines (31 loc) · 889 Bytes
/
sided.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sides from './sides.mjs'
import { generateSpaceScaleProperties, getScalePropertyNames } from './lib/scales.mjs'
export default function sided(state={}) {
const { config = {}, template } = state
let output = ''
if (config.spaceScale) {
const sideKeys = Object.keys(sides)
const properties = generateSpaceScaleProperties(config.spaceScale)
const propertyNames = getScalePropertyNames(properties)
propertyNames.forEach(pn => {
const step = pn.replace('--space-', '')
// All sides
output += template({
label: '',
step,
side: '',
value: `var(${pn})`
})
// Single and double sides
sideKeys.forEach(sideKey => {
output += template({
label: sideKey,
step,
side: sides[sideKey],
value: `var(${pn})`
})
})
})
}
return output
}