Skip to content

Commit 86c5842

Browse files
committed
Responsive: small height computer screens #6
1 parent 73c65e2 commit 86c5842

File tree

4 files changed

+39
-10
lines changed

4 files changed

+39
-10
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"react/react-in-jsx-scope": 0,
1414
"react/jsx-closing-bracket-location": [1, "props-aligned"],
1515
"react/no-find-dom-node": 0
16+
},
17+
"globals": {
18+
"window": true
1619
}
1720
}

components/SubscribeForm.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ class SubscribeForm extends React.Component {
2121
}
2222
}
2323

24+
componentDidMount() {
25+
// when focusing on small screens, browser sets scrollTop to make sure
26+
// input is in view, which we don't want
27+
if (window.screen.height >= 768) {
28+
this.formEmail.textHandler.focus()
29+
}
30+
}
31+
2432
onSubmit(event) {
2533
event.preventDefault()
2634
const email = this.formEmail.state.value
@@ -62,7 +70,6 @@ class SubscribeForm extends React.Component {
6270
ref={(email) => {
6371
this.formEmail = email
6472
}}
65-
autoFocus
6673
/>
6774
<RaisedButton
6875
label="Get early access"

css/raw.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ body {
1212
font-size: 18px;
1313
line-height: 1.7;
1414
}
15-
1615
@media screen and (max-width: 760px) {
1716
body {
1817
font-size: 16px;
@@ -28,6 +27,15 @@ a:hover {
2827
text-decoration: underline;
2928
}
3029
30+
.form-container {
31+
margin-top: 30px;
32+
}
33+
@media (max-height: 825px) {
34+
.form-container {
35+
margin-top: 10px;
36+
}
37+
}
38+
3139
.ripple-ball {
3240
width: 50px;
3341
height: 50px;
@@ -55,8 +63,14 @@ a:hover {
5563
}
5664
5765
.logo-collection .svg-wrapper {
58-
width: 100px;
59-
height: 100px;
66+
width: 80px;
67+
height: 80px;
68+
}
69+
@media (max-height: 799px) {
70+
.logo-collection .svg-wrapper {
71+
width: 50px;
72+
height: 50px;
73+
}
6074
}
6175
.logo-collection svg {
6276
width: 100%;

pages/index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ class Index extends Component {
242242
style={{
243243
opacity: 0,
244244
padding: '20px 20px 0 20px',
245+
marginTop: 0,
245246
marginBottom: 0,
246247
maxWidth: '600px',
247248
}}
@@ -250,8 +251,8 @@ class Index extends Component {
250251
<b>
251252
The GraphQL Guide
252253
</b>
253-
{` is an upcoming book on GraphQL, the best way to write an API or
254-
fetch data for your app. `}
254+
{` is an upcoming book on GraphQL (which is the best way to write an API or
255+
fetch data for your app). `}
255256
<a href="https://twitter.com/helferjs">
256257
Jonas
257258
</a>
@@ -263,12 +264,15 @@ class Index extends Component {
263264
<a href="https://twitter.com/lorendsr">
264265
Loren
265266
</a>
266-
{' is a full-stack freelancer and '}
267+
{' is a freelancer and '}
267268
<a href="https://www.meteor.com/">
268269
Meteor
269270
</a>
270-
{` maintainer. We’re in the process of writing the best GraphQL
271-
reference, which includes:`}
271+
{' maintainer. We’re in the process of writing '}
272+
<em>
273+
the best
274+
</em>
275+
{' GraphQL reference, which includes:'}
272276
</p>
273277
<Delay
274278
ms={3500}
@@ -375,16 +379,17 @@ class Index extends Component {
375379
</LogoLI>
376380
</section>
377381
<Paper
382+
className="form-container"
378383
style={{
379384
display: 'flex',
380385
flexDirection: 'column',
381386
alignItems: 'center',
382387
justifyContent: 'center',
383388
width: 500,
384389
opacity: 0,
385-
marginTop: 30,
386390
paddingTop: 10,
387391
paddingBottom: 10,
392+
marginBottom: 20,
388393
willChange: 'opacity, transform',
389394
}}
390395
zDepth={2}

0 commit comments

Comments
 (0)