on 23dbfee help sign in
bridge/src/components/OldHeader.js
52 lines 1.3 kB history raw
1import React from 'react'
2import { Button, Chevron } from '../components/Base'
4import { renderRoute } from '../lib/router'
5import { isLast } from '../lib/lib'
7const Crumbs = (props) => {
8 const { routeCrumbs, skipRoute } = props
9 const history = routeCrumbs.reverse()
11 // FIXME probably more straightforward to render them normally and just
12 // return the reversed array of renders
13 const rendered = history.map((route, idx) => {
15 return (
16 <div className={'flex items-center'} key={ `history-${idx}` }>
18 <Button
19 size={'s'}
20 type={'link'}
21 color={'black'}
22 key={ `history-button-${idx}` }
23 onClick={ () => skipRoute(history.size - idx - 1) }
24 >
25 { `${renderRoute(props, route)}` }
26 </Button>
28 {
29 isLast(history.size, idx)
30 ? <div />
31 : <Chevron className={'h-4 mh-2'} />
32 }
34 </div>
35 )
36 })
38 return rendered
41const Header = (props) =>
42 <div className={'flex items-center h-8 pt-4'}>
43 <Crumbs
44 routeCrumbs={ props.routeCrumbs }
45 skipRoute={ props.skipRoute }
46 networkType={ props.networkType }
47 wallet={ props.wallet }
48 pointCursor={ props.pointCursor }
49 />
50 </div>
52export default Header