Skip to content

Commit 019e7e5

Browse files
committed
Slide header down from top on small screens
1 parent 96fd7b5 commit 019e7e5

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

css/raw.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ main.-landing {
5252
}
5353
.landing-header {
5454
width: 43vw;
55+
transform: translateX(-100%);
5556
}
5657
.book-title {
5758
margin: 5vh 0 15vh 0;
@@ -63,6 +64,7 @@ main.-landing {
6364
@media (max-width: ${iPadMaxW}px) {
6465
.landing-header {
6566
width: 100vw;
67+
transform: translateY(-100%);
6668
}
6769
6870
.book-title {

pages/index.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Ripple from '../components/ripple'
2323
import Emoji from '../components/emoji'
2424

2525
import muiTheme from '../lib/muitheme'
26-
import { white, color, grey } from '../lib/styles'
26+
import { white, color, grey, iPadMaxW } from '../lib/styles'
2727
import withData from '../lib/withData'
2828

2929
// fixes "Warning: Unknown prop `onTouchTap` on <label> tag."
@@ -64,15 +64,31 @@ class Index extends Component {
6464
const logos = ReactDOM.findDOMNode(this.logos)
6565
const comingSoon = ReactDOM.findDOMNode(this.comingSoon)
6666

67+
const headerStart = (window.screen.width > iPadMaxW
68+
? {
69+
x: -header.offsetWidth, // '-100%' percentage not supported
70+
}
71+
: {
72+
y: -header.offsetHeight,
73+
}
74+
)
75+
76+
const headerDest = (window.screen.width > iPadMaxW
77+
? {
78+
x: 0,
79+
}
80+
: {
81+
y: 0,
82+
}
83+
)
84+
6785
const animation = new TimelineLite({ paused: true })
6886

6987
// timeline.to(header, 2, { rotationX: 0, scale: 1.3 })
7088

7189
const path = 'M0,0 C0.46,0 0.804,0.243 0.87,0.368 0.928,0.478 0.884,0.4 1,1'
7290
const ease = CustomEase.create('steep-fall', path)
73-
TweenLite.set(header, {
74-
x: -header.offsetWidth, // '-100%' percentage not supported
75-
})
91+
TweenLite.set(header, headerStart)
7692
TweenLite.set(introPara, {
7793
x: -50,
7894
opacity: 0,
@@ -89,7 +105,7 @@ class Index extends Component {
89105
animation
90106
.delay(0.6) // wait for browser to not be busy. todo requestIdleCallback
91107
.to(header, 1, {
92-
x: 0,
108+
...headerDest,
93109
ease: Power2.easeIn,
94110
})
95111
.to(introPara, 1.5, {
@@ -136,7 +152,6 @@ class Index extends Component {
136152
backgroundColor: color,
137153
color: white,
138154
willChange: 'transform',
139-
transform: 'translateX(-100%)',
140155
}}
141156
ref={(header) => { this.header = header }}
142157
>

0 commit comments

Comments
 (0)