constelation / monorepo

Mono repo for constelation's Components, functions, and CONSTANTS
https://constelation.github.io/monorepo/
MIT License
12 stars 3 forks source link

View, Flex, Row, Col, aligns #33

Closed kylpo closed 7 years ago

kylpo commented 7 years ago

Notes for how to solve or explain the case for View hiding its flexbox implementation with alignHorizontal and alignVertical props vs align, justify.

Main problem for not using alignHorizontal and alignVertical in Flex, Col, Row is the existence of justify-content's space-between, space-around, space-evenly, and align-items's baseline, stretch. How to support alignH/V while still enabling those values?

cc @thomasbruketta

kylpo commented 7 years ago

One attempt:

<View
  horizontal
  alignHorizontal='left'
  alignVertical='top'
  spaceItems='between' | 'around' | 'evenly'
  ...
/>

Starts to break down there. Based on flex-direction, the spaceItems value will override alignHorizontal or alignVertical, which is weird.

/shurg

kylpo commented 7 years ago

Another idea from Thomas: remove alignHorizontal and alignVertical. Have View function as Flex is today. This means there'd also be no reason to have Col, so Row should go away, too (see the horizontal prop above).

Pros: deletes code in monorepo, reduces components available, probably less to explain Cons: lose the convenient align_s, locked in to the association of View using flexbox, lose out on some context for skimming: View, Col, Row, Flex have distinct purposes that are easier to discover than a prop, but that might not be a big deal

<View
  horizontal
  align='flex-end'                     // or 'end' (and 'start' over 'flex-start')
  justify='space-between'
  ...
/>
kylpo commented 7 years ago

Another: let Col and Row use alignH|V, with align and justify overrides

<Row
  alignHorizontal='right'
  alignVertical='bottom'
  justify='space-between'    // overrides alignHorizontal
  ...
/>

that way, alignH|V is just a convenience prop for flex-start, center, flex-end.

Pros: get to use alignH|V Row and Col for the more common justify and aligns Cons: confusion in how/why an alignH=right is not honored. Muddies the boundaries more between the 4 components