Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase top margin for iPhone X #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
elm 0.18
4 changes: 2 additions & 2 deletions app/DirectionPicker/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import App.Font as Font
import Message exposing (..)
import ScrollableTabView exposing (..)
import Model exposing (Model)

import Hacks.IPhoneX exposing(isIPhoneX)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, that namespace 😆


topMargin : Float
topMargin =
Expand All @@ -18,7 +18,7 @@ topMargin =
10

IOS ->
20
if isIPhoneX then 40 else 20


view : Model -> List (Node Msg) -> Node Msg
Expand Down
22 changes: 22 additions & 0 deletions app/Hacks/IPhoneX.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Hacks.IPhoneX exposing (isIPhoneX)

import NativeApi.Dimensions exposing (window)
import NativeApi.Platform as Platform exposing (OS(..))

isIPhoneX : Bool
isIPhoneX =
isIOS && matchesIPhoneXDimensions


isIOS : Bool
isIOS =
case Platform.os of
Android -> False
IOS -> True

matchesIPhoneXDimensions : Bool
matchesIPhoneXDimensions =
let
iPhoneXHeight = 812
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth extracting to its own constant function?

in
window.height == iPhoneXHeight || window.width == iPhoneXHeight