mdgriffith / elm-ui

What if you never had to write CSS again?
https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/
BSD 3-Clause "New" or "Revised" License
1.35k stars 110 forks source link

Composable padding, spacing, width, rounded attributes #297

Open pravdomil opened 3 years ago

pravdomil commented 3 years ago

Hi, I'm coming from Bootstrap and I'm missing one feature that I used a lot.

What if el [ padding { left = 8, right = 8, top = 8, bottom = 16 } ] becomes el [ padding 8, paddingBottom 16 ].

Than I can use just add a border at top, or add more padding at bottom to some reusable view: reusableView [ borderTop 1, paddingBottom 18 ]

Also I can have composable spacing utils, for example I can define my view as: row [ defaultPadding, biggerBottomPadding ]

And for me is easier to read [ padding 8, paddingBottom 16 ] then [ padding { left = 8, right = 8, top = 8, bottom = 16 }].

Here are new function names:

Element.padding and Border.width: propXY becomes propXY, propX, propY propEach becomes propLeft, propRight, propTop, propBottom

Element.spacing: spacingXY becomes spacingXY, spacingX, spacingY

Border.rounded: roundEach becomes roundedTopLeft, roundedTopRight, roundedBottomLeft, roundedBottomRight