Browse Source

Merge pull request #173 from meriadec/master

Styles updates on button & account page
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
71bf956582
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/components/AccountPage.js
  2. 4
      src/components/Breadcrumb/Step.js
  3. 2
      src/components/DashboardPage/AccountCard.js
  4. 4
      src/components/ReceiveBox.js
  5. 2
      src/components/SelectAccount/index.js
  6. 2
      src/components/TopBar.js
  7. 2
      src/components/TransactionsList/index.js
  8. 23
      src/components/base/Button/index.js
  9. 45
      src/components/base/Button/stories.js
  10. 2
      src/components/base/CheckBox/index.js
  11. 4
      src/components/base/Input/index.js
  12. 2
      src/components/base/Modal/index.js
  13. 2
      src/components/base/Select/Triangles.js
  14. 8
      src/components/base/Select/index.js
  15. 2
      src/components/base/Tabs/index.js
  16. 10
      src/icons/Controls.js
  17. 10
      src/styles/helpers.js
  18. 2
      src/styles/theme.js

11
src/components/AccountPage.js

@ -19,6 +19,7 @@ import { openModal } from 'reducers/modals'
import Box, { Card } from 'components/base/Box' import Box, { Card } from 'components/base/Box'
import Button from 'components/base/Button' import Button from 'components/base/Button'
import Icon from 'components/base/Icon' import Icon from 'components/base/Icon'
import IconControls from 'icons/Controls'
import ReceiveBox from 'components/ReceiveBox' import ReceiveBox from 'components/ReceiveBox'
import Text from 'components/base/Text' import Text from 'components/base/Text'
import TransactionsList from 'components/TransactionsList' import TransactionsList from 'components/TransactionsList'
@ -70,11 +71,13 @@ class AccountPage extends PureComponent<Props> {
</Box> </Box>
</Button> </Button>
<Button <Button
style={{ width: 50 }} style={{ width: 40, padding: 0 }}
icon="sliders-h"
color="mouse"
onClick={() => openModal(MODAL_SETTINGS_ACCOUNT, { account })} onClick={() => openModal(MODAL_SETTINGS_ACCOUNT, { account })}
/> >
<Box align="center">
<IconControls width={16} />
</Box>
</Button>
</Box> </Box>
</Box> </Box>
<Box horizontal flow={3}> <Box horizontal flow={3}>

4
src/components/Breadcrumb/Step.js

@ -8,7 +8,7 @@ import Box from 'components/base/Box'
const Wrapper = styled(Box).attrs({ const Wrapper = styled(Box).attrs({
align: 'center', align: 'center',
justify: 'center', justify: 'center',
color: p => (p.isActive ? 'wallet' : 'mouse'), color: p => (p.isActive ? 'wallet' : 'fog'),
})` })`
width: 40px; width: 40px;
flex-shrink: 0; flex-shrink: 0;
@ -19,7 +19,7 @@ const Wrapper = styled(Box).attrs({
const Number = styled(Box).attrs({ const Number = styled(Box).attrs({
align: 'center', align: 'center',
justify: 'center', justify: 'center',
color: p => (p.isActive ? 'white' : 'mouse'), color: p => (p.isActive ? 'white' : 'fog'),
bg: p => (p.isActive ? 'wallet' : 'pearl'), bg: p => (p.isActive ? 'wallet' : 'pearl'),
})` })`
width: 20px; width: 20px;

2
src/components/DashboardPage/AccountCard.js

@ -36,7 +36,7 @@ const AccountCard = ({
</Box> </Box>
</Box> </Box>
</Box> </Box>
<Bar size={1} color="argile" /> <Bar size={2} color="fog" />
<Box grow justifyContent="center" color="dark"> <Box grow justifyContent="center" color="dark">
<FormattedVal <FormattedVal
alwaysShowSign={false} alwaysShowSign={false}

4
src/components/ReceiveBox.js

@ -24,7 +24,7 @@ export const AddressBox = styled(Box).attrs({
p: 2, p: 2,
})` })`
border-radius: 3px; border-radius: 3px;
border: 1px solid ${p => p.theme.colors.mouse}; border: 1px solid ${p => p.theme.colors.fog};
cursor: text; cursor: text;
text-align: center; text-align: center;
user-select: text; user-select: text;
@ -33,7 +33,7 @@ export const AddressBox = styled(Box).attrs({
const Action = styled(Box).attrs({ const Action = styled(Box).attrs({
alignItems: 'center', alignItems: 'center',
color: 'mouse', color: 'fog',
flex: 1, flex: 1,
flow: 1, flow: 1,
fontSize: 0, fontSize: 0,

2
src/components/SelectAccount/index.js

@ -29,7 +29,7 @@ const renderItem = item => (
</Text> </Text>
</Box> </Box>
<Box> <Box>
<Text color="mouse" fontSize={4}> <Text color="fog" fontSize={4}>
{formatBTC(item.balance)} {formatBTC(item.balance)}
</Text> </Text>
</Box> </Box>

2
src/components/TopBar.js

@ -46,7 +46,7 @@ const Inner = styled(Box).attrs({
const Bar = styled.div` const Bar = styled.div`
height: 15px; height: 15px;
width: 1px; width: 1px;
background: #ff0000; background: ${p => p.theme.colors.fog};
` `
const Activity = styled.div` const Activity = styled.div`

2
src/components/TransactionsList/index.js

@ -58,7 +58,7 @@ const TransactionRaw = styled(Box).attrs({
horizontal: true, horizontal: true,
alignItems: 'center', alignItems: 'center',
})` })`
border-bottom: 1px solid ${p => p.theme.colors.argile}; border-bottom: 1px solid ${p => p.theme.colors.fog};
height: 68px; height: 68px;
&:last-child { &:last-child {

23
src/components/base/Button/index.js

@ -5,6 +5,8 @@ import styled from 'styled-components'
import { space, fontSize, fontWeight, color } from 'styled-system' import { space, fontSize, fontWeight, color } from 'styled-system'
import noop from 'lodash/noop' import noop from 'lodash/noop'
import { darken, lighten } from 'styles/helpers'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import Icon from 'components/base/Icon' import Icon from 'components/base/Icon'
@ -14,11 +16,19 @@ const Base = styled.button`
${fontSize}; ${fontSize};
${fontWeight}; ${fontWeight};
border-radius: 5px; border-radius: 5px;
border: ${p => (p.primary ? '' : `1px solid ${p.theme.colors.mouse}`)}; border: ${p =>
p.primary ? 'none' : `2px solid ${p.disabled ? 'transparent' : p.theme.colors.grey}`};
cursor: ${p => (p.disabled ? 'default' : 'pointer')}; cursor: ${p => (p.disabled ? 'default' : 'pointer')};
height: 40px; height: 40px;
box-shadow: ${p => (p.withShadow ? 'rgba(0, 0, 0, 0.2) 0 3px 10px' : '')};
outline: none; outline: none;
&:hover {
background: ${p => (p.primary ? lighten(p.theme.colors.wallet, 0.05) : '')};
}
&:active {
background: ${p => (p.primary ? darken(p.theme.colors.wallet, 0.1) : '')};
}
` `
type Props = { type Props = {
@ -33,6 +43,7 @@ function getProps({ disabled, icon, primary }: Object) {
const props = (predicate, props, defaults = {}) => (predicate ? props : defaults) const props = (predicate, props, defaults = {}) => (predicate ? props : defaults)
return { return {
color: 'grey',
...props( ...props(
icon, icon,
{ {
@ -49,7 +60,6 @@ function getProps({ disabled, icon, primary }: Object) {
{ {
color: 'white', color: 'white',
bg: 'wallet', bg: 'wallet',
withShadow: true,
}, },
{ {
bg: 'transparent', bg: 'transparent',
@ -57,13 +67,14 @@ function getProps({ disabled, icon, primary }: Object) {
), ),
...props(disabled, { ...props(disabled, {
color: 'white', color: 'white',
bg: 'argile', bg: 'fog',
withShadow: false,
}), }),
} }
} }
const Button = ({ children, onClick, primary, icon, disabled, ...props }: Props) => { const Button = (props: Props) => {
const { onClick, primary, icon, disabled } = props
let { children } = props
children = icon ? ( children = icon ? (
<Box alignItems="center" justifyContent="center"> <Box alignItems="center" justifyContent="center">
<Icon name={icon} /> <Icon name={icon} />

45
src/components/base/Button/stories.js

@ -2,10 +2,51 @@
import React from 'react' import React from 'react'
import { storiesOf } from '@storybook/react' import { storiesOf } from '@storybook/react'
import styled from 'styled-components'
import Button from 'components/base/Button' import Button from 'components/base/Button'
const stories = storiesOf('Components/Button', module) const stories = storiesOf('Components/Button', module)
stories.add('basic', () => <Button>{'Do some action'}</Button>) const Th = styled.th`
stories.add('primary', () => <Button primary>{'Validate'}</Button>) padding: 20px;
`
const Td = styled.td`
padding: 20px;
min-width: 150px;
`
stories.add('all', () => (
<table border={1}>
<thead>
<tr>
<Th />
<Th>normal</Th>
<Th>disabled</Th>
</tr>
</thead>
<tbody>
<tr>
<Td>normal</Td>
<Td>
<Button>Normal button</Button>
</Td>
<Td>
<Button disabled>Normal button</Button>
</Td>
</tr>
<tr>
<Td>primary</Td>
<Td>
<Button primary>Primary button</Button>
</Td>
<Td>
<Button primary disabled>
Primary button
</Button>
</Td>
</tr>
</tbody>
</table>
))

2
src/components/base/CheckBox/index.js

@ -36,7 +36,7 @@ const Base = styled(Tabbable).attrs({
transition: all ease-in 0.1s; transition: all ease-in 0.1s;
&:focus { &:focus {
border-color: ${p => p.theme.colors.mouse}; border-color: ${p => p.theme.colors.fog};
} }
` `

4
src/components/base/Input/index.js

@ -12,7 +12,7 @@ const Base = styled.input.attrs({
})` })`
${space}; ${space};
${fontFamily}; ${fontFamily};
border: 1px solid ${p => p.theme.colors.mouse}; border: 1px solid ${p => p.theme.colors.fog};
border-radius: 3px; border-radius: 3px;
display: flex; display: flex;
width: 100%; width: 100%;
@ -20,7 +20,7 @@ const Base = styled.input.attrs({
background: ${p => p.theme.colors.white}; background: ${p => p.theme.colors.white};
&::placeholder { &::placeholder {
color: ${p => p.theme.colors.mouse}; color: ${p => p.theme.colors.fog};
} }
&:focus { &:focus {

2
src/components/base/Modal/index.js

@ -94,7 +94,7 @@ const Body = styled(Box).attrs({
const CloseContainer = styled(Box).attrs({ const CloseContainer = styled(Box).attrs({
p: 4, p: 4,
color: 'mouse', color: 'fog',
})` })`
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;

2
src/components/base/Select/Triangles.js

@ -28,6 +28,6 @@ const Triangles = ({ size, color }: { size?: number, color?: string }) => (
</Box> </Box>
) )
Triangles.defaultProps = { size: 5, color: 'mouse' } Triangles.defaultProps = { size: 5, color: 'fog' }
export default Triangles export default Triangles

8
src/components/base/Select/index.js

@ -41,7 +41,7 @@ const TriggerBtn = styled(Box).attrs({
})` })`
min-height: 64px; min-height: 64px;
${space}; ${space};
border: 1px solid ${p => p.theme.colors.mouse}; border: 1px solid ${p => p.theme.colors.fog};
border-radius: 3px; border-radius: 3px;
display: flex; display: flex;
width: 100%; width: 100%;
@ -63,7 +63,7 @@ const Item = styled(Box).attrs({
const ItemWrapper = styled(Box)` const ItemWrapper = styled(Box)`
& + & { & + & {
border-top: 1px solid ${p => p.theme.colors.mouse}; border-top: 1px solid ${p => p.theme.colors.fog};
} }
` `
@ -71,7 +71,7 @@ const Dropdown = styled(Box).attrs({
mt: 1, mt: 1,
})` })`
border-radius: 3px; border-radius: 3px;
border: 1px solid ${p => p.theme.colors.mouse}; border: 1px solid ${p => p.theme.colors.fog};
box-shadow: rgba(0, 0, 0, 0.05) 0 2px 2px; box-shadow: rgba(0, 0, 0, 0.05) 0 2px 2px;
left: 0; left: 0;
position: absolute; position: absolute;
@ -246,7 +246,7 @@ class Select extends PureComponent<Props> {
{selectedItem && renderSelected ? ( {selectedItem && renderSelected ? (
renderSelected(selectedItem) renderSelected(selectedItem)
) : ( ) : (
<Text color="mouse">{placeholder}</Text> <Text color="fog">{placeholder}</Text>
)} )}
</Box> </Box>
<FloatingTriangles> <FloatingTriangles>

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

@ -10,7 +10,7 @@ import Box, { Tabbable } from 'components/base/Box'
const WrapperTab = styled(Box).attrs({ const WrapperTab = styled(Box).attrs({
horizontal: true, horizontal: true,
})` })`
border-bottom: 1px solid ${p => p.theme.colors.argile}; border-bottom: 1px solid ${p => p.theme.colors.fog};
` `
const Tab = styled(Tabbable).attrs({ const Tab = styled(Tabbable).attrs({

10
src/icons/Controls.js

@ -0,0 +1,10 @@
import React from 'react'
export default props => (
<svg viewBox="0 0 16 16" {...props}>
<path
fill="currentColor"
d="M3.417 14a.75.75 0 1 1-1.5 0V9.333a.75.75 0 1 1 1.5 0V14zm0-7.333a.75.75 0 0 1-1.5 0V2a.75.75 0 1 1 1.5 0v4.667zM8.75 14a.75.75 0 1 1-1.5 0V8a.75.75 0 0 1 1.5 0v6zm0-8.667a.75.75 0 1 1-1.5 0V2a.75.75 0 0 1 1.5 0v3.333zM14.083 14a.75.75 0 1 1-1.5 0v-3.333a.75.75 0 0 1 1.5 0V14zm0-6a.75.75 0 1 1-1.5 0V2a.75.75 0 0 1 1.5 0v6zM.667 10.083a.75.75 0 1 1 0-1.5h4a.75.75 0 0 1 0 1.5h-4zm5.333-4a.75.75 0 1 1 0-1.5h4a.75.75 0 1 1 0 1.5H6zm5.333 5.334a.75.75 0 0 1 0-1.5h4a.75.75 0 1 1 0 1.5h-4z"
/>
</svg>
)

10
src/styles/helpers.js

@ -11,6 +11,16 @@ export const rgba = (c: string, a: number) =>
.rgb() .rgb()
.toString() .toString()
export const darken = (c: string, a: number) =>
Color(c)
.darken(a)
.toString()
export const lighten = (c: string, a: number) =>
Color(c)
.lighten(a)
.toString()
export const ff = (v: string) => { export const ff = (v: string) => {
const [font, type = 'Regular'] = v.split('|') const [font, type = 'Regular'] = v.split('|')
const { style, weight } = fontFamilies[font][type] const { style, weight } = fontFamilies[font][type]

2
src/styles/theme.js

@ -63,8 +63,6 @@ export const fontFamilies = {
export const colors = { export const colors = {
transparent: 'transparent', transparent: 'transparent',
argile: '#ff0000',
mouse: '#ff0000',
pearl: '#ff0000', pearl: '#ff0000',
// new colors // new colors

Loading…
Cancel
Save