diff --git a/www/src/App.elm b/www/src/App.elm index 88437fd..7d9509b 100644 --- a/www/src/App.elm +++ b/www/src/App.elm @@ -349,16 +349,25 @@ colors = } +isMobile : E.Device -> Bool +isMobile device = + case device.orientation of + E.Landscape -> + False + + E.Portrait -> + True + + searchBar : Model -> E.Element Msg searchBar model = let alignment = - case model.device.class of - E.Phone -> - E.column + if isMobile model.device then + E.column - _ -> - E.row + else + E.row in alignment [ E.padding 10 @@ -543,39 +552,38 @@ viewCardBrowser model = ] details = - case model.device.class of - E.Phone -> - E.column - [ E.spacing 10 - , E.padding 10 - , E.height <| E.fillPortion 1 - , E.width E.fill - , Background.color colors.sidebar - , E.scrollbarY - ] - <| - case model.activeCard of - Just card -> - E.paragraph [ Font.heavy, Font.size 24, Font.center ] [ E.text card.name ] - :: List.map (\text -> E.paragraph [ Font.size 16 ] [ E.text text ]) - (String.lines card.oracleText) + if isMobile model.device then + E.column + [ E.spacing 10 + , E.padding 10 + , E.height <| E.fillPortion 1 + , E.width E.fill + , Background.color colors.sidebar + , E.scrollbarY + ] + <| + case model.activeCard of + Just card -> + E.paragraph [ Font.heavy, Font.size 24, Font.center ] [ E.text card.name ] + :: List.map (\text -> E.paragraph [ Font.size 16 ] [ E.text text ]) + (String.lines card.oracleText) - _ -> - [ E.none ] + _ -> + [ E.none ] - _ -> - E.el - [ E.alignTop - , E.width <| E.fillPortion 1 - , E.height E.fill - , Background.color colors.sidebar - ] - (Maybe.map - cardDetails - model.activeCard - |> Maybe.withDefault - E.none - ) + else + E.el + [ E.alignTop + , E.width <| E.fillPortion 1 + , E.height E.fill + , Background.color colors.sidebar + ] + (Maybe.map + cardDetails + model.activeCard + |> Maybe.withDefault + E.none + ) navButton text maybeUrl = case maybeUrl of @@ -596,16 +604,15 @@ viewCardBrowser model = cards cardPage = let attrs = - case model.device.class of - E.Phone -> - [ E.width E.fill - , E.height <| E.fillPortion 3 - ] + if isMobile model.device then + [ E.width E.fill + , E.height <| E.fillPortion 3 + ] - _ -> - [ E.width <| E.fillPortion 2 - , E.height E.fill - ] + else + [ E.width <| E.fillPortion 2 + , E.height E.fill + ] in E.column attrs [ E.row @@ -639,24 +646,23 @@ viewCardBrowser model = Spinner.view manaSpinner model.spinner Ready cardPage -> - case model.device.class of - E.Phone -> - E.column - [ E.width E.fill - , E.height E.fill - , Font.color colors.text - , E.scrollbarY - ] - [ details, cards cardPage ] + if isMobile model.device then + E.column + [ E.width E.fill + , E.height E.fill + , Font.color colors.text + , E.scrollbarY + ] + [ details, cards cardPage ] - _ -> - E.row - [ E.width E.fill - , E.height E.fill - , Font.color colors.text - , E.scrollbarY - ] - [ details, cards cardPage ] + else + E.row + [ E.width E.fill + , E.height E.fill + , Font.color colors.text + , E.scrollbarY + ] + [ details, cards cardPage ] onEnter : msg -> E.Attribute msg