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

Make classifyDevice's DeviceClass based on the shorter side of the window.

commitb65a490c23508fb90a7bcf28ebf7e106c55144bf authorMatthew Griffith <mdg.griffith@gmail.com> dateWed 12 Jun 2019, 19:35 (7 years ago) parent28cc86acf86ea8
1 file changed+11−3
src/Element.elm+11−3
src/Element.elm+11−3
@@ -1538,13 +1538,21 @@ type Orientation
15381538classifyDevice : { window | height : Int, width : Int } -> Device
15391539classifyDevice window =
15401540 { class =
1541− if window.width <= 600 then
1541+ let
1542+ shortSide =
1543+ if window.width < window.height then
1544+ window.width
1545+
1546+ else
1547+ window.height
1548+ in
1549+ if shortSide <= 600 then
15421550 Phone
15431551
1544− else if window.width > 600 && window.width <= 1200 then
1552+ else if shortSide > 600 && shortSide <= 1200 then
15451553 Tablet
15461554
1547− else if window.width > 1200 && window.width <= 1800 then
1555+ else if shortSide > 1200 && shortSide <= 1800 then
15481556 Desktop
15491557
15501558 else