forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
44 lines (40 loc) · 1.05 KB
/
index.tsx
File metadata and controls
44 lines (40 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as React from 'react'
import { Wrapper, Link } from './elements'
import Search from '../Search'
import ViewSelector from '../ViewSelector'
type Props = {
currentPage: string
selectedTheme: string
}
class TopBar extends React.Component<Props> {
node: HTMLElement
componentDidMount() {
requestAnimationFrame(() => (this.node.style.top = '0'))
}
render() {
const { selectedTheme, currentPage } = this.props
return (
<Wrapper
innerRef={(node) => {
this.node = node
}}
>
<Link href="/" selected={currentPage === '/'}>
Home
</Link>
<Link href="/guides" selected={currentPage.indexOf('/guides') === 0}>
Guides
</Link>
<Link href="/videos" selected={currentPage.indexOf('/videos') === 0}>
Videos
</Link>
<Link href="/api" selected={currentPage.indexOf('/api') === 0}>
Api
</Link>
<Search />
<ViewSelector selectedTheme={selectedTheme} />
</Wrapper>
)
}
}
export default TopBar