Create Tailwind module
Moving the UI.tw function into Tailwind.use. Creating and consuming some functions like Tailwind.if_ and Tailwind.when to make it easier to conditionally style some of my components.
This commit is contained in:
parent
7b2163d804
commit
f92fe97aff
5 changed files with 49 additions and 27 deletions
29
website/sandbox/learnpianochords/src/Tailwind.elm
Normal file
29
website/sandbox/learnpianochords/src/Tailwind.elm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
module Tailwind exposing (..)
|
||||
|
||||
{-| Functions to make Tailwind development in Elm even more pleasant.
|
||||
-}
|
||||
|
||||
|
||||
{-| Conditionally use `class` selection when `condition` is true.
|
||||
-}
|
||||
when : Bool -> String -> String
|
||||
when condition class =
|
||||
if condition then
|
||||
class
|
||||
|
||||
else
|
||||
""
|
||||
|
||||
|
||||
if_ : Bool -> String -> String -> String
|
||||
if_ condition whenTrue whenFalse =
|
||||
if condition then
|
||||
whenTrue
|
||||
|
||||
else
|
||||
whenFalse
|
||||
|
||||
|
||||
use : List String -> String
|
||||
use styles =
|
||||
String.join " " styles
|
||||
Loading…
Add table
Add a link
Reference in a new issue