sebastiaanvisser / clay

A CSS preprocessor as embedded Haskell.
Other
357 stars 72 forks source link

Change directions to angles in linearGradient. Otherwise the CSS com… #222

Open ddssff opened 2 years ago

ddssff commented 2 years ago

…es out

"linear-gradient(bottom, ..." rather than "linear-graident(to bottom, ...". With this we get "linear-gradient(180deg, ...".

turion commented 2 years ago

I think linearGradient and repeatingLinearGradient are the only functions using this Direction. Which means:

Looking into https://www.w3schools.com/csSref/func_repeating-linear-gradient.asp, I'm actually getting the impression that Direction is not defined in a sensible way to begin with. A better definition would be something like:

data Direction = DirectionSide Side | DirectionCorner Side side | DirectionAngle (Angle Deg)

instance Val Direction where
  value (DirectionSide side) = "to " <> value side
  ...

(An even better definition would allow any kind of angle, not just degrees.)

But I can understand if redefining Direction like that is too much for a quick fix PR.

ddssff commented 2 years ago

Maybe we could write new tickets for further improvements.

turion commented 2 years ago

True, then the best path forward is changing the Val instance, I think.

turion commented 1 year ago

Can you add a unit test for this?

ddssff commented 1 year ago

uh oh I don't even remember what a linear gradient is :upside_down_face: