git.iko.soy/typeable/elm-ui
on master help sign in
Classify device using the longer side of the display
commitd218ef9135c18d55cf2555105a42bcee5b452e63 authorTom Stejskal <tom.stejskal@gmail.com> dateSat 22 Jun 2019, 08:33 (7 years ago) parentb060765
1 file changed+5−9
src/Element.elm+5−9
src/Element.elm+5−9
@@ -1550,20 +1550,16 @@ classifyDevice : { window | height : Int, width : Int } -> Device
15501550classifyDevice window =
15511551 { class =
15521552 let
1553− shortSide =
1554− if window.width < window.height then
1555− window.width
1556−
1557− else
1558− window.height
1553+ longSide =
1554+ max window.width window.height
15591555 in
1560− if shortSide <= 600 then
1556+ if longSide <= 600 then
15611557 Phone
15621558
1563− else if shortSide > 600 && shortSide <= 1200 then
1559+ else if longSide > 600 && longSide <= 1200 then
15641560 Tablet
15651561
1566− else if shortSide > 1200 && shortSide <= 1800 then
1562+ else if longSide > 1200 && longSide <= 1800 then
15671563 Desktop
15681564
15691565 else