diff options
author | William Carroll <wpcarro@gmail.com> | 2020-04-19T12·40+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-04-19T12·42+0100 |
commit | f92fe97aff16fa65ed8d4587b74b132811ff04ec (patch) | |
tree | b73f9cda33f132bc2b6823ff3d7d98d8939067d9 /website/sandbox/learnpianochords/src/UI.elm | |
parent | 7b2163d804a67054b7ac1bf5d8eb047b39dd92d9 (diff) |
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.
Diffstat (limited to 'website/sandbox/learnpianochords/src/UI.elm')
-rw-r--r-- | website/sandbox/learnpianochords/src/UI.elm | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/website/sandbox/learnpianochords/src/UI.elm b/website/sandbox/learnpianochords/src/UI.elm index 4fa8f65fb54c..50bbaaa2142d 100644 --- a/website/sandbox/learnpianochords/src/UI.elm +++ b/website/sandbox/learnpianochords/src/UI.elm @@ -4,6 +4,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import Responsive +import Tailwind type Color @@ -31,11 +32,6 @@ textForColor color = "text-black" -tw : List String -> String -tw styles = - String.join " " styles - - simpleButton : { label : String , handleClick : msg @@ -57,7 +53,7 @@ simpleButton { label, handleClick, color, classes } = ] in button - [ class (tw <| List.concat [ buttonClasses, classes ]) + [ class (Tailwind.use <| List.concat [ buttonClasses, classes ]) , onClick handleClick ] [ text label ] @@ -90,7 +86,7 @@ textToggleButton { label, toggled, handleClick, classes } = ] in button - [ class (tw <| List.concat [ buttonClasses, classes ]) + [ class (Tailwind.use <| List.concat [ buttonClasses, classes ]) , onClick handleClick ] [ text label ] @@ -116,7 +112,7 @@ textField { placeholderText, handleInput, classes } = ] in input - [ class (tw <| List.concat [ inputClasses, classes ]) + [ class (Tailwind.use <| List.concat [ inputClasses, classes ]) , onInput handleInput , placeholder placeholderText ] @@ -139,17 +135,11 @@ overlayButton { label, handleClick, isVisible } = , "z-30" , "w-screen" , "h-screen" + , Tailwind.if_ isVisible "opacity-100" "opacity-0" ] - - extraClasses = - if isVisible then - [ "opacity-100" ] - - else - [ "opacity-0" ] in button - [ List.concat [ classes, extraClasses ] |> tw |> class + [ classes |> Tailwind.use |> class , style "background-color" "rgba(0,0,0,0.30)" , onClick handleClick ] @@ -157,7 +147,7 @@ overlayButton { label, handleClick, isVisible } = [ style "-webkit-text-stroke-width" "2px" , style "-webkit-text-stroke-color" "black" , class <| - tw + Tailwind.use [ "transform" , "-rotate-90" , "text-white" |