- all
- x, y
- all
- top, right, bottom, left
- x, y
- auto
paddings.all[0] // 0 til 4 |
/** | |
* given a model and a direction it returns a function which given | |
* a `size` returns an object like `{ paddingLeft: 0 }` | |
*/ | |
const gen = | |
(model, direction) => | |
(size) => ({ [model + upper(direction)]: size }) | |
//generateDirections('margin', ['top', 'bottom']) |
const left = gen('padding', 'left') | |
const right = gen('padding', 'right') | |
const top = gen('padding', 'top') | |
const bottom = gen('padding', 'bottom') | |
const all = size => ({ padding: size }) | |
const x = size => ({ ...left(size), ...right(size) }) | |
// or: const x = size => mergeAll([ left(size), right(size) ]) | |
const y = size => ({ ...top(size), ...bottom(size) }) |
const left = gen('margin', 'left') | |
const right = gen('margin', 'right') | |
const top = gen('margin', 'top') | |
const bottom = gen('margin', 'bottom') | |
const all = size => ({ margin: size }) | |
const x = size => ({ ...left(size), ..right(size) }) | |
const y = size => ({ ...top(size), ..bottom(size) }) | |
const auto = () => x('auto') | |