about summary refs log tree commit diff
path: root/website/sandbox/learnpianochords/src/Tailwind.elm
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-04-19T12·40+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-04-19T12·42+0100
commitf92fe97aff16fa65ed8d4587b74b132811ff04ec (patch)
treeb73f9cda33f132bc2b6823ff3d7d98d8939067d9 /website/sandbox/learnpianochords/src/Tailwind.elm
parent7b2163d804a67054b7ac1bf5d8eb047b39dd92d9 (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/Tailwind.elm')
-rw-r--r--website/sandbox/learnpianochords/src/Tailwind.elm29
1 files changed, 29 insertions, 0 deletions
diff --git a/website/sandbox/learnpianochords/src/Tailwind.elm b/website/sandbox/learnpianochords/src/Tailwind.elm
new file mode 100644
index 000000000000..57d419db5a82
--- /dev/null
+++ b/website/sandbox/learnpianochords/src/Tailwind.elm
@@ -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