Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phantom types: background-repeat #411

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 103 additions & 1 deletion src/Css.elm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module Css
, backgroundPosition
, backgroundPosition2
, backgroundPosition4
, backgroundRepeat
, backgroundRepeat2
, baseline
, batch
, before
Expand Down Expand Up @@ -203,12 +205,16 @@ module Css
, rad
, relative
, rem
, repeat
, repeatX
, repeatY
, revert
, rgb
, rgba
, ridge
, right
, right_
, round
, rowResize
, rtl
, sResize
Expand All @@ -230,6 +236,7 @@ module Css
, smaller
, softLight
, solid
, space
, stackedFractions
, start
, static
Expand Down Expand Up @@ -359,10 +366,12 @@ All CSS properties can have the values `unset`, `initial`, and `inherit`.

## Background Image

@docs backgroundImage, backgroundImages, backgroundPosition, backgroundPosition2, backgroundPosition4
@docs backgroundImage, backgroundImages, backgroundPosition, backgroundPosition2, backgroundPosition4, backgroundRepeat, backgroundRepeat2

@docs linearGradient, stop, stop2, toBottom, toBottomLeft, toBottomRight, toLeft, toRight, toTop, toTopLeft, toTopRight

@docs repeat, repeatX, repeatY, space, round


## Box Shadow

Expand Down Expand Up @@ -3978,6 +3987,99 @@ backgroundPosition4 (Value horiz) (Value horizAmount) (Value vert) (Value vertAm



-- BACKGROUND REPEAT --


{-| Sets [`background-repeat`](https://css-tricks.com/almanac/properties/b/background-repeat/)

backgroundRepeat repeat

backgroundRepeat repeatX

If you need to set horizontal and vertical direction separately, see
[`backgroundRepeat2`](#backgroundRepeat2)

-}
backgroundRepeat :
Value
{ repeat : Supported
, repeatX : Supported
, repeatY : Supported
, space : Supported
, round : Supported
, initial : Supported
, unset : Supported
}
-> Style
backgroundRepeat (Value repeat) =
AppendProperty ("background-repeat:" ++ repeat)


{-| Sets [`background-repeat`](https://css-tricks.com/almanac/properties/b/background-repeat/) along the horizontal axis, then the vertical axis.

backgroundRepeat2 repeat space

backgroundRepeat2 space round

If you only need to set one value for both, see
[`backgroundRepeat`](#backgroundRepeat) instead.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the explanation and linking between backgroundRepeat and backgroundRepeat2! 😍


-}
backgroundRepeat2 :
Value
{ repeat : Supported
, space : Supported
, round : Supported
, initial : Supported
, unset : Supported
}
-> Style
backgroundRepeat2 (Value repeat) =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might've missed an argument here? 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haaaaaaaaaaaaa yeah

AppendProperty ("background-repeat:" ++ repeat)


{-| [Repeat a background](#backgroundRepeat).
-}
repeat : Value { provides | repeat : Supported }
repeat =
Value "repeat"


{-| [Repeat a background](#backgroundRepeat) side to side.
-}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On these Value docs, can we get links to https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat#Values and mention that this compiles to the "repeat-x" value in CSS? (Similar to this, for example.)

Code examples would also be great, even if they're copy/pasted from the background docs. 😄

repeatX : Value { provides | repeatX : Supported }
repeatX =
Value "repeat-x"


{-| [Repeat a background](#backgroundRepeat) up and down.
-}
repeatY : Value { provides | repeatY : Supported }
repeatY =
Value "repeat-y"


{-| [Repeat a background](#backgroundRepeat) without cutting off the edges by
putting **space** between the repetitions. See the [css-tricks article on
this](https://css-tricks.com/almanac/properties/b/background-repeat/) for more
details.
-}
space : Value { provides | space : Supported }
space =
Value "space"


{-| [Repeat a background](#backgroundRepeat) without cutting off the edges by
stretching or shrinking the images slightly. See the [css-tricks article on
this](https://css-tricks.com/almanac/properties/b/background-repeat/) for more
details.
-}
round : Value { provides | round : Supported }
round =
Value "round"



{- GRADIENTS -}


Expand Down