Loëck Vézien
7 years ago
committed by
GitHub
10 changed files with 183 additions and 21 deletions
@ -0,0 +1,15 @@ |
|||
// @flow
|
|||
|
|||
import React, { PureComponent } from 'react' |
|||
|
|||
import Box from 'components/base/Box' |
|||
|
|||
type Props = {} |
|||
|
|||
class AccountPage extends PureComponent<Props> { |
|||
render() { |
|||
return <Box>{'account'}</Box> |
|||
} |
|||
} |
|||
|
|||
export default AccountPage |
@ -0,0 +1,15 @@ |
|||
// @flow
|
|||
|
|||
import React, { PureComponent } from 'react' |
|||
|
|||
import Box from 'components/base/Box' |
|||
|
|||
type Props = {} |
|||
|
|||
class SettingsPage extends PureComponent<Props> { |
|||
render() { |
|||
return <Box>{'settings'}</Box> |
|||
} |
|||
} |
|||
|
|||
export default SettingsPage |
@ -1,17 +0,0 @@ |
|||
// @flow
|
|||
|
|||
import React, { PureComponent } from 'react' |
|||
|
|||
import Box from 'components/base/Box' |
|||
|
|||
class SideBar extends PureComponent<{}> { |
|||
render() { |
|||
return ( |
|||
<Box bg="night" py={3} noShrink style={{ width: 250 }}> |
|||
{''} |
|||
</Box> |
|||
) |
|||
} |
|||
} |
|||
|
|||
export default SideBar |
@ -0,0 +1,81 @@ |
|||
// @flow
|
|||
|
|||
import React from 'react' |
|||
import styled from 'styled-components' |
|||
import { compose } from 'redux' |
|||
import { withRouter } from 'react-router' |
|||
import { push } from 'react-router-redux' |
|||
import { connect } from 'react-redux' |
|||
|
|||
import type { Element } from 'react' |
|||
import type { Location } from 'react-router' |
|||
|
|||
import Box from 'components/base/Box' |
|||
import Text from 'components/base/Text' |
|||
|
|||
type Props = { |
|||
children: string, |
|||
linkTo?: string | null, |
|||
desc?: string | null, |
|||
icon?: Element<*> | null, |
|||
location: Location, |
|||
push: Function, |
|||
} |
|||
|
|||
const mapDispatchToProps = { |
|||
push, |
|||
} |
|||
|
|||
const Container = styled(Box).attrs({ |
|||
horizontal: true, |
|||
align: 'center', |
|||
color: 'lead', |
|||
p: 2, |
|||
})` |
|||
cursor: pointer; |
|||
color: ${p => (p.active ? p.theme.colors.white : '')}; |
|||
|
|||
&:hover { |
|||
background: rgba(255, 255, 255, 0.05); |
|||
} |
|||
` |
|||
|
|||
const IconWrapper = styled(Box)` |
|||
width: 30px; |
|||
height: 30px; |
|||
border: 2px solid rgba(255, 255, 255, 0.1); |
|||
` |
|||
|
|||
function Item({ children, desc, icon, linkTo, push, location }: Props) { |
|||
const { pathname } = location |
|||
return ( |
|||
<Container onClick={linkTo ? () => push(linkTo) : void 0} active={pathname === linkTo}> |
|||
<IconWrapper mr={2}>{icon || null}</IconWrapper> |
|||
<div> |
|||
<Text fontWeight="bold" fontSize={1}> |
|||
{children} |
|||
</Text> |
|||
{desc && ( |
|||
<Box color="steel" fontSize={0}> |
|||
{desc} |
|||
</Box> |
|||
)} |
|||
</div> |
|||
</Container> |
|||
) |
|||
} |
|||
|
|||
Item.defaultProps = { |
|||
icon: null, |
|||
desc: null, |
|||
linkTo: null, |
|||
} |
|||
|
|||
export default compose( |
|||
withRouter, |
|||
// connect router here only to make components re-render
|
|||
// see https://github.com/ReactTraining/react-router/issues/4671
|
|||
connect(({ router }) => ({ router }), mapDispatchToProps, null, { |
|||
pure: false, |
|||
}), |
|||
)(Item) |
@ -0,0 +1,55 @@ |
|||
// @flow
|
|||
|
|||
import React, { PureComponent } from 'react' |
|||
import styled from 'styled-components' |
|||
|
|||
import Box, { GrowScroll } from 'components/base/Box' |
|||
import Item from './Item' |
|||
|
|||
const CapsSubtitle = styled(Box).attrs({ |
|||
px: 2, |
|||
fontSize: 0, |
|||
color: 'shark', |
|||
})` |
|||
text-transform: uppercase; |
|||
font-weight: bold; |
|||
` |
|||
|
|||
class SideBar extends PureComponent<{}> { |
|||
render() { |
|||
return ( |
|||
<Box noShrink style={{ width: 250 }}> |
|||
<GrowScroll flow={4} py={4} bg="night"> |
|||
<Box flow={2}> |
|||
<CapsSubtitle>{'Menu'}</CapsSubtitle> |
|||
<div> |
|||
<Item linkTo="/">{'Dashboard'}</Item> |
|||
<Item>{'Send'}</Item> |
|||
<Item>{'Receive'}</Item> |
|||
<Item linkTo="/settings">{'Settings'}</Item> |
|||
</div> |
|||
</Box> |
|||
<Box flow={2}> |
|||
<CapsSubtitle>{'Accounts'}</CapsSubtitle> |
|||
<div> |
|||
<Item linkTo="/account/brian" desc="BTC 3.78605936"> |
|||
{'Brian Account'} |
|||
</Item> |
|||
<Item linkTo="/account/virginie" desc="ETH 0.05944"> |
|||
{'Virginie Account'} |
|||
</Item> |
|||
<Item linkTo="/account/ledger" desc="DOGE 2.2658"> |
|||
{'Ledger Account'} |
|||
</Item> |
|||
<Item linkTo="/account/nicolas" desc="BTC 0.00015486"> |
|||
{'Nicolas Account'} |
|||
</Item> |
|||
</div> |
|||
</Box> |
|||
</GrowScroll> |
|||
</Box> |
|||
) |
|||
} |
|||
} |
|||
|
|||
export default SideBar |
Loading…
Reference in new issue