clay icon indicating copy to clipboard operation
clay copied to clipboard

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

Open ddssff opened this issue 3 years ago • 5 comments

…es out

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

ddssff avatar Jan 02 '22 17:01 ddssff

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

  • repeatingLinearGradient has the same bug like linearGradient
  • we could just change the Val instance to your fix instead, essentially fixing both functions

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.

turion avatar Jan 07 '22 19:01 turion

Maybe we could write new tickets for further improvements.

ddssff avatar Jan 10 '22 05:01 ddssff

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

turion avatar Jan 11 '22 20:01 turion

Can you add a unit test for this?

turion avatar Jul 07 '23 14:07 turion

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

ddssff avatar Jul 07 '23 14:07 ddssff