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.34k stars 110 forks source link

Feature request: attribute 'none' #340

Open staeter opened 2 years ago

staeter commented 2 years ago

The equivalent of Element.none but for attributes:

it would give

maybeBlur =
    if blur then
        Html.Attributes.style "filter" "blur(4px)"
            |> Element.htmlAttribute
    else
        Element.Attributes.none

view =
    Element.el
        [ ...
        , maybeBlur
        ]
        Element.none

instead of

maybeBlur =
    if blur then
        Html.Attributes.style "filter" "blur(4px)"
            |> Element.htmlAttribute
            |> List.singleton
    else
        []

view =
    Element.el
        ( [ ...
          ]
               ++ maybeBlur
        )
        Element.none
pravdomil commented 2 years ago

I'm using:

noneAttribute : Attribute msg
noneAttribute =
    htmlAttribute (Html.Attributes.classList [])