Skip to content

Commit c716d94

Browse files
committed
add workaround for content height to not exceed view height on mobile
1 parent b2573da commit c716d94

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
This is their landing page, it's made with the [Gatsby](https://www.gatsbyjs.org/) framework!.
66

77
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
8+
[![Maintainability](https://api.codeclimate.com/v1/badges/a99a88d28ad37a79dbf6/maintainability)](https://codeclimate.com/github/codeclimate/codeclimate/maintainability)

gatsby-browser.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
exports.onClientEntry = () => {
2+
// The value in the --wh custom property set to the root of the document
3+
document.documentElement.style.setProperty("--wh", `${window.innerHeight}px`);
4+
window.addEventListener("resize", () => {
5+
document.documentElement.style.setProperty(
6+
"--wh",
7+
`${window.innerHeight}px`
8+
);
9+
});
10+
};

src/components/layout.css

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ html {
33
}
44
body {
55
margin: 0;
6-
background: lavender;
76
}
87

98
footer {

src/components/layout.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ const Layout = ({ children }) => (
1212
);
1313

1414
const Page = styled.div`
15-
min-height: 100vh;
15+
background: lavender;
16+
min-height: 100vh; /* Fallback for browsers that do not support Custom Properties */
17+
min-height: var(--wh, 100vh);
1618
display: flex;
1719
flex-direction: column;
1820
align-items: center;

0 commit comments

Comments
 (0)