File tree Expand file tree Collapse file tree 1 file changed +20
-11
lines changed Expand file tree Collapse file tree 1 file changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,7 @@ export default class IndexPage extends Component<
23
23
state = { selected : 0 }
24
24
25
25
handleClick = event => {
26
- this . setState ( { selected : parseInt ( event . target . value , 10 ) } , ( ...args ) => {
27
- console . log ( 'handleClick' , args , this . state , this . _node . childNodes [ 9 ] )
26
+ this . setState ( { selected : parseInt ( event . target . value , 10 ) } , ( ) => {
28
27
scrollIntoViewIfNeeded ( this . _node . children [ this . state . selected ] , false , {
29
28
duration : 300 ,
30
29
} )
@@ -33,18 +32,16 @@ export default class IndexPage extends Component<
33
32
34
33
render ( ) {
35
34
return (
36
- < div >
37
- < style jsx global > { `
38
- body {
39
- font-family: ${ systemFontStack } ;
40
- }
41
- ` } </ style >
35
+ < section >
42
36
< Head >
43
- < title > scrollIntoViewIfNeeded test page </ title >
37
+ < title > scrollIntoViewIfNeeded example </ title >
44
38
</ Head >
45
39
46
- < h1 > scrollIntoViewIfNeeded test page </ h1 >
40
+ < h1 > scrollIntoViewIfNeeded example </ h1 >
47
41
< style jsx > { `
42
+ section {
43
+ font-family: ${ systemFontStack } ;
44
+ }
48
45
ul {
49
46
border: 1px solid #aaa;
50
47
height: 7em;
@@ -72,6 +69,10 @@ export default class IndexPage extends Component<
72
69
li:nth-child(8n + 1) {
73
70
display: block;
74
71
}
72
+
73
+ footer {
74
+ margin-top: 20px;
75
+ }
75
76
` } </ style >
76
77
< ul
77
78
ref = { node => {
@@ -98,7 +99,15 @@ export default class IndexPage extends Component<
98
99
</ button >
99
100
) ) }
100
101
</ div >
101
- </ div >
102
+ < footer >
103
+ < a
104
+ href = "https://github.com/stipsan/scroll-into-view-if-needed"
105
+ target = "_blank"
106
+ >
107
+ GitHub
108
+ </ a >
109
+ </ footer >
110
+ </ section >
102
111
)
103
112
}
104
113
}
You can’t perform that action at this time.
0 commit comments