File tree Expand file tree Collapse file tree 2 files changed +20
-18
lines changed
Expand file tree Collapse file tree 2 files changed +20
-18
lines changed Original file line number Diff line number Diff line change 11import React from "react" ;
22import ReactDOM from "react-dom" ;
33import PropTypes from "prop-types" ;
4+ import getHeaderStyle from './utils/getHeaderStyle' ;
45
56document . body . style . background = `
67 linear-gradient(135deg,
@@ -11,24 +12,7 @@ document.body.style.background = `
1112 )
1213` ;
1314
14- const getHeaderStyle = y => {
15- const pin = y >= 100 ;
16- const top = - y / 2 ;
17- return {
18- textTransform : "uppercase" ,
19- textAlign : "center" ,
20- width : "100%" ,
21- margin : 0 ,
22- position : "fixed" ,
23- top : pin ? "0px" : `${ top + 50 } px` ,
24- textShadow : pin
25- ? `0px ${ ( y - 100 ) / 5 } px ${ Math . min (
26- ( y - 100 ) / 10 ,
27- 20
28- ) } px rgba(0, 0, 0, 0.5)`
29- : "none"
30- } ;
31- } ;
15+
3216
3317class App extends React . Component {
3418 state = { y : 0 } ;
Original file line number Diff line number Diff line change 1+ export default function ( y ) {
2+ const pin = y >= 100 ;
3+ const top = - y / 2 ;
4+ return {
5+ textTransform : "uppercase" ,
6+ textAlign : "center" ,
7+ width : "100%" ,
8+ margin : 0 ,
9+ position : "fixed" ,
10+ top : pin ? "0px" : `${ top + 50 } px` ,
11+ textShadow : pin
12+ ? `0px ${ ( y - 100 ) / 5 } px ${ Math . min (
13+ ( y - 100 ) / 10 ,
14+ 20
15+ ) } px rgba(0, 0, 0, 0.5)`
16+ : "none"
17+ } ;
18+ } ;
You can’t perform that action at this time.
0 commit comments