git.iko.soy/typeable/elm-ui
on master help sign in
Merge pull request #123 from tomstejskal/master

Classify device using the longer side of the display

commitf9728c11b8795770bf58c352b5d9b23882e90ab5 authorMatthew Griffith <mdg.griffith@gmail.com> dateSun 21 Jul 2019, 09:36 (7 years ago) parentdb1b5acd218ef9
1 file changed+5−9
src/Element.elm+5−9
src/Element.elm+5−9
@@ -1558,20 +1558,16 @@ classifyDevice : { window | height : Int, width : Int } -> Device
15581558classifyDevice window =
15591559 { class =
15601560 let
1561− shortSide =
1562− if window.width < window.height then
1563− window.width
1564−
1565− else
1566− window.height
1561+ longSide =
1562+ max window.width window.height
15671563 in
1568− if shortSide <= 600 then
1564+ if longSide <= 600 then
15691565 Phone
15701566
1571− else if shortSide > 600 && shortSide <= 1200 then
1567+ else if longSide > 600 && longSide <= 1200 then
15721568 Tablet
15731569
1574− else if shortSide > 1200 && shortSide <= 1800 then
1570+ else if longSide > 1200 && longSide <= 1800 then
15751571 Desktop
15761572
15771573 else