Skip to content

Commit 1272020

Browse files
authored
cleanup + add footer with github link (#146)
1 parent 6cc8040 commit 1272020

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

example/pages/index.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export default class IndexPage extends Component<
2323
state = { selected: 0 }
2424

2525
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) }, () => {
2827
scrollIntoViewIfNeeded(this._node.children[this.state.selected], false, {
2928
duration: 300,
3029
})
@@ -33,18 +32,16 @@ export default class IndexPage extends Component<
3332

3433
render() {
3534
return (
36-
<div>
37-
<style jsx global>{`
38-
body {
39-
font-family: ${systemFontStack};
40-
}
41-
`}</style>
35+
<section>
4236
<Head>
43-
<title>scrollIntoViewIfNeeded test page</title>
37+
<title>scrollIntoViewIfNeeded example</title>
4438
</Head>
4539

46-
<h1>scrollIntoViewIfNeeded test page</h1>
40+
<h1>scrollIntoViewIfNeeded example</h1>
4741
<style jsx>{`
42+
section {
43+
font-family: ${systemFontStack};
44+
}
4845
ul {
4946
border: 1px solid #aaa;
5047
height: 7em;
@@ -72,6 +69,10 @@ export default class IndexPage extends Component<
7269
li:nth-child(8n + 1) {
7370
display: block;
7471
}
72+
73+
footer {
74+
margin-top: 20px;
75+
}
7576
`}</style>
7677
<ul
7778
ref={node => {
@@ -98,7 +99,15 @@ export default class IndexPage extends Component<
9899
</button>
99100
))}
100101
</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>
102111
)
103112
}
104113
}

0 commit comments

Comments
 (0)