Skip to content

Commit

Permalink
[www] Make iPhone X compatible (#9449)
Browse files Browse the repository at this point in the history
<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->

This should fix #9448. 
Also added padding to the banner, layout and desktop navigation to make sure it also works in landscape mode on the iPhone X
![img_0218](https://user-images.githubusercontent.com/13830735/47585018-794b5980-d95c-11e8-9a4e-8d7da85c47e6.PNG)
  • Loading branch information
gurtjun authored and DSchau committed Oct 29, 2018
1 parent 3d62117 commit 0f2913d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions www/src/components/banner.js
Expand Up @@ -15,6 +15,8 @@ const BannerContainer = styled("div")`
position: fixed;
width: 100%;
z-index: 3;
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
`

const InnerContainer = styled("div")`
Expand Down
6 changes: 6 additions & 0 deletions www/src/components/layout.js
Expand Up @@ -148,6 +148,10 @@ class DefaultLayout extends React.Component {
return (
<div className={isHomepage ? `is-homepage` : ``}>
<Helmet defaultTitle={`GatsbyJS`} titleTemplate={`%s | GatsbyJS`}>
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
/>
<meta name="twitter:site" content="@gatsbyjs" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="GatsbyJS" />
Expand Down Expand Up @@ -194,6 +198,8 @@ class DefaultLayout extends React.Component {
? presets.bannerHeight
: `calc(${presets.bannerHeight} + ${presets.headerHeight})`,
},
paddingLeft: `env(safe-area-inset-left)`,
paddingRight: `env(safe-area-inset-right)`,
}}
>
<PageWithSidebar
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/navigation-mobile.js
Expand Up @@ -63,7 +63,7 @@ const MobileNavigation = () => (
zIndex: 1,
borderTop: `1px solid ${colors.ui.border}`,
background: colors.ui.whisper,
height: presets.headerHeight,
minHeight: presets.headerHeight,
fontFamily: typography.options.headerFontFamily.join(`,`),
paddingBottom: `env(safe-area-inset-bottom)`,
[presets.Tablet]: {
Expand Down
2 changes: 2 additions & 0 deletions www/src/components/navigation.js
Expand Up @@ -98,6 +98,8 @@ const Navigation = ({ pathname }) => {
position: isHomepage || isBlog ? `absolute` : `fixed`,
backgroundColor: isBlog ? colors.ui.whisper : false,
},
paddingLeft: `env(safe-area-inset-left)`,
paddingRight: `env(safe-area-inset-right)`,
}}
>
<div
Expand Down

0 comments on commit 0f2913d

Please sign in to comment.