about summary refs log tree commit diff
path: root/website/sandbox/learnpianochords/src/UI.elm
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-04-19T12·05+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-04-19T12·05+0100
commit2fe6d7a10c8656de9a2e08e187486625d23c3535 (patch)
treed6b5869b94ef13d7ab081495c572e410b270e0d6 /website/sandbox/learnpianochords/src/UI.elm
parent74ebb8e86997bffe98d4b062028d1b25740725ff (diff)
Responsively size UI
TL;DR: scale down UI for non-mobile devices.

I pulled the screen resolution for my phone, the Google Pixel 4, off of the
internet. I created a device profile in Chrome to develop this application
specifically for my phone. To my surprise, when I opened the app on my phone,
many of elements that looked good in Google Chrome, looked askew on my phone. I
needed to troubleshoot.

Here's how I did that:
I used Tailwind to responsively color the bg for each breakpoint to see if my
device was sm, md, lg, xl (according to Tailwind's breakpoint
terminology). After reading Tailwind's documentation and comparing their
breakpoints with my Pixel 4's width (i.e. 1080px), I figured that my device
would be lg. It's not; it's md, which I confirmed by using ngrok to load
localhost:8000 on my phone and see that the background-color was
"md:bg-green-600".

I'm still unsure why my device is not lg, but knowing that my device was md
was enough to fix many of the styling issues. My current theory is that while
my screen's resolution is 1080 wide, the pixel density affects the media query
for the breakpoint.
Diffstat (limited to 'website/sandbox/learnpianochords/src/UI.elm')
-rw-r--r--website/sandbox/learnpianochords/src/UI.elm17
1 files changed, 12 insertions, 5 deletions
diff --git a/website/sandbox/learnpianochords/src/UI.elm b/website/sandbox/learnpianochords/src/UI.elm
index ac15b37d54fe..dd0b7d2e0c7e 100644
--- a/website/sandbox/learnpianochords/src/UI.elm
+++ b/website/sandbox/learnpianochords/src/UI.elm
@@ -3,6 +3,7 @@ module UI exposing (..)
 import Html exposing (..)
 import Html.Attributes exposing (..)
 import Html.Events exposing (..)
+import Responsive
 
 
 type Color
@@ -48,9 +49,11 @@ simpleButton { label, handleClick, color, classes } =
             [ bgForColor color
             , textForColor color
             , "py-10"
+            , "lg:py-6"
             , "px-20"
-            , "text-5xl"
+            , "lg:px-12"
             , "rounded-lg"
+            , Responsive.h2
             ]
     in
     button
@@ -80,8 +83,10 @@ textToggleButton { label, toggled, handleClick, classes } =
             [ textColor
             , textTreatment
             , "py-8"
+            , "lg:py-5"
             , "px-10"
-            , "text-5xl"
+            , "lg:px-6"
+            , Responsive.h2
             ]
     in
     button
@@ -100,12 +105,14 @@ textField :
 textField { placeholderText, handleInput, classes } =
     let
         inputClasses =
-            [ "text-5xl"
-            , "w-full"
+            [ "w-full"
             , "py-10"
+            , "lg:py-6"
             , "px-16"
+            , "lg:px-10"
             , "border"
             , "rounded-lg"
+            , Responsive.h2
             ]
     in
     input
@@ -153,9 +160,9 @@ overlayButton { label, handleClick, isVisible } =
                 tw
                     [ "transform"
                     , "-rotate-90"
-                    , "text-6xl"
                     , "text-white"
                     , "font-mono"
+                    , Responsive.h1
                     ]
             ]
             [ text label ]