Browse Source

Work on SettingsPage

master
meriadec 7 years ago
parent
commit
af69d7f512
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 1
      src/components/SettingsPage/Profile.js
  2. 10
      src/components/SettingsPage/index.js
  3. 6
      src/components/base/Box/index.js
  4. 32
      src/components/base/Tabs/index.js

1
src/components/SettingsPage/Profile.js

@ -33,7 +33,6 @@ type Props = {
unlock: Function,
}
type State = {
tab: number,
inputValue: InputValue,
}

10
src/components/SettingsPage/index.js

@ -8,12 +8,18 @@ import Tabs from 'components/base/Tabs'
import TabProfile from './Profile'
type Props = {}
type State = {
tab: number,
}
class SettingsPage extends PureComponent<Props, State> {
state = {
tab: 'profile',
tab: 6,
}
handleChangeTab = tab => this.setState({ tab })
handleChangeTab = (tab: number) => this.setState({ tab })
render() {
const { tab } = this.state

6
src/components/base/Box/index.js

@ -59,7 +59,7 @@ const RawCard = styled(Box).attrs({ bg: 'white', p: 3 })`
border-radius: 5px;
`
export const Card = ({ title, ...props }: { title: string }) => {
export const Card = ({ title, ...props }: { title?: string }) => {
if (title) {
return (
<Box flow={2}>
@ -73,6 +73,10 @@ export const Card = ({ title, ...props }: { title: string }) => {
return <RawCard {...props} />
}
Card.defaultProps = {
title: undefined,
}
export const GrowScroll = (props: *) => (
<Box grow relative>
<Box sticky scroll {...props} />

32
src/components/base/Tabs/index.js

@ -2,7 +2,6 @@
import React, { Fragment } from 'react'
import styled from 'styled-components'
import isString from 'lodash/isString'
import type { Element } from 'react'
@ -36,24 +35,17 @@ type Props = {
onTabClick: number => void,
}
const Tabs = ({ items, index, onTabClick }: Props) => {
const item = isString(index) ? items.find(item => item.key === index) : items[index]
return (
<Fragment>
<Box horizontal borderBottom borderWidth={1} borderColor="argile">
{items.map((item, i) => (
<Tab
key={item.key}
isActive={isString(index) ? index === item.key : index === i}
onClick={() => onTabClick(i)}
>
{item.title}
</Tab>
))}
</Box>
{item && item.render()}
</Fragment>
)
}
const Tabs = ({ items, index, onTabClick }: Props) => (
<Fragment>
<Box horizontal borderBottom borderWidth={1} borderColor="argile">
{items.map((item, i) => (
<Tab key={item.key} isActive={index === i} onClick={() => onTabClick(i)}>
{item.title}
</Tab>
))}
</Box>
{items[index] && items[index].render()}
</Fragment>
)
export default Tabs

Loading…
Cancel
Save