Browse Source

Update CurrentAddress design

master
Loëck Vézien 7 years ago
committed by meriadec
parent
commit
d35b62b336
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 94
      src/components/CurrentAddress/index.js
  2. 3
      src/components/CurrentAddress/stories.js
  3. 11
      src/components/base/Modal/index.js
  4. 7
      src/components/layout/Print.js
  5. 6
      src/components/modals/Receive/04-step-receive-funds.js
  6. 1
      static/i18n/en/currentAddress.yml

94
src/components/CurrentAddress/index.js

@ -1,7 +1,7 @@
// @flow // @flow
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import { translate } from 'react-i18next' import { Trans, translate } from 'react-i18next'
import styled from 'styled-components' import styled from 'styled-components'
import noop from 'lodash/noop' import noop from 'lodash/noop'
@ -25,20 +25,12 @@ import IconShield from 'icons/Shield'
const Container = styled(Box).attrs({ const Container = styled(Box).attrs({
borderRadius: 1, borderRadius: 1,
alignItems: 'center', alignItems: 'center',
bg: p => (p.withQRCode ? 'lightGrey' : 'transparent'), bg: p =>
py: 5, p.withQRCode ? (p.notValid ? rgba(p.theme.colors.alertRed, 0.02) : 'lightGrey') : 'transparent',
py: 4,
px: 7, px: 7,
})``
const WrapperAddress = styled(Box).attrs({
alignItems: 'center',
borderRadius: 1,
py: p => (p.notValid ? 4 : 0),
px: 4,
})` })`
background: ${p => (p.notValid ? rgba(p.theme.colors.alertRed, 0.05) : 'transparent')}; border: ${p => (p.notValid ? `1px dashed ${rgba(p.theme.colors.alertRed, 0.5)}` : 'none')};
border: ${p => (p.notValid ? `1px dashed ${rgba(p.theme.colors.alertRed, 0.26)}` : 'none')};
width: 100%;
` `
const Address = styled(Box).attrs({ const Address = styled(Box).attrs({
@ -63,11 +55,17 @@ const Label = styled(Box).attrs({
fontSize: 4, fontSize: 4,
flow: 1, flow: 1,
horizontal: true, horizontal: true,
})`` })`
strong {
color: ${p => p.theme.colors.dark};
font-weight: 600;
border-bottom: 1px dashed ${p => p.theme.colors.dark};
}
`
const Footer = styled(Box).attrs({ const Footer = styled(Box).attrs({
horizontal: true, horizontal: true,
mt: 5, mt: 4,
})` })`
text-transform: uppercase; text-transform: uppercase;
width: 100%; width: 100%;
@ -77,9 +75,20 @@ const FooterButtonWrapper = styled(Box).attrs({
color: 'grey', color: 'grey',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
grow: true, borderRadius: 1,
})` })`
cursor: pointer; cursor: pointer;
height: 55px;
width: 55px;
&:hover {
background-color: rgba(100, 144, 241, 0.1);
color: ${p => p.theme.colors.dark};
svg {
color: ${p => p.theme.colors.wallet};
}
}
` `
const FooterButton = ({ const FooterButton = ({
@ -91,15 +100,18 @@ const FooterButton = ({
label: string, label: string,
onClick: Function, onClick: Function,
}) => ( }) => (
<FooterButtonWrapper onClick={onClick}> <Box grow alignItems="center" justifyContent="center">
{icon} <FooterButtonWrapper onClick={onClick}>
<Box fontSize={3} ff="Museo Sans|Bold" mt={1}> {icon}
{label} <Box fontSize={3} ff="Museo Sans|Bold" mt={1}>
</Box> {label}
</FooterButtonWrapper> </Box>
</FooterButtonWrapper>
</Box>
) )
type Props = { type Props = {
accountName?: string,
address: string, address: string,
addressVerified?: boolean, addressVerified?: boolean,
amount?: string, amount?: string,
@ -130,6 +142,7 @@ class CurrentAddress extends PureComponent<Props> {
render() { render() {
const { const {
accountName,
address, address,
addressVerified, addressVerified,
amount, amount,
@ -149,20 +162,27 @@ class CurrentAddress extends PureComponent<Props> {
return ( return (
<Container withQRCode={withQRCode} notValid={notValid} {...props}> <Container withQRCode={withQRCode} notValid={notValid} {...props}>
<WrapperAddress notValid={notValid} grow> {withQRCode && (
{withQRCode && ( <Box mb={4}>
<Box mb={4}> <QRCode size={120} data={`bitcoin:${address}${amount ? `?amount=${amount}` : ''}`} />
<QRCode size={150} data={`bitcoin:${address}${amount ? `?amount=${amount}` : ''}`} /> </Box>
</Box> )}
)} <Label>
<Label> <Box>
<Box>{t('currentAddress:label')}</Box> {accountName ? (
<IconInfoCircle size={12} /> <Trans i18nKey="currentAddress:labelFrom" parent="div">
</Label> {'Address from '}
<Address withQRCode={withQRCode} notValid={notValid}> <strong>{accountName}</strong>
{address} </Trans>
</Address> ) : (
</WrapperAddress> t('currentAddress:label')
)}
</Box>
<IconInfoCircle size={12} />
</Label>
<Address withQRCode={withQRCode} notValid={notValid}>
{address}
</Address>
{withBadge && ( {withBadge && (
<Box horizontal flow={2} mt={2} alignItems="center"> <Box horizontal flow={2} mt={2} alignItems="center">
<Box color={notValid ? 'alertRed' : 'wallet'}> <Box color={notValid ? 'alertRed' : 'wallet'}>
@ -186,7 +206,7 @@ class CurrentAddress extends PureComponent<Props> {
)} )}
/> />
<Print <Print
data={{ address, amount }} data={{ address, amount, accountName }}
render={(print, isLoading) => ( render={(print, isLoading) => (
<FooterButton <FooterButton
icon={<IconPrint size={16} />} icon={<IconPrint size={16} />}

3
src/components/CurrentAddress/stories.js

@ -2,7 +2,7 @@
import React from 'react' import React from 'react'
import { storiesOf } from '@storybook/react' import { storiesOf } from '@storybook/react'
import { boolean } from '@storybook/addon-knobs' import { boolean, text } from '@storybook/addon-knobs'
import CurrentAddress from 'components/CurrentAddress' import CurrentAddress from 'components/CurrentAddress'
@ -12,6 +12,7 @@ const stories = storiesOf('Components', module)
stories.add('CurrentAddress', () => ( stories.add('CurrentAddress', () => (
<CurrentAddress <CurrentAddress
accountName={text('accountName', '')}
address={accounts[0].address} address={accounts[0].address}
addressVerified={boolean('addressVerified', true)} addressVerified={boolean('addressVerified', true)}
withBadge={boolean('withBadge', false)} withBadge={boolean('withBadge', false)}

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

@ -55,8 +55,6 @@ const mapDispatchToProps: Function = (dispatch, { name, onClose = noop }): * =>
const Container = styled(Box).attrs({ const Container = styled(Box).attrs({
color: 'grey', color: 'grey',
alignItems: 'center',
justifyContent: 'flex-start',
sticky: true, sticky: true,
style: p => ({ style: p => ({
pointerEvents: p.isVisible ? 'auto' : 'none', pointerEvents: p.isVisible ? 'auto' : 'none',
@ -79,8 +77,6 @@ const Backdrop = styled(Box).attrs({
const Wrapper = styled(Tabbable).attrs({ const Wrapper = styled(Tabbable).attrs({
bg: 'transparent', bg: 'transparent',
flow: 4, flow: 4,
mt: 100,
mb: 100,
style: p => ({ style: p => ({
opacity: p.op, opacity: p.op,
transform: `scale3d(${p.scale}, ${p.scale}, ${p.scale})`, transform: `scale3d(${p.scale}, ${p.scale}, ${p.scale})`,
@ -175,12 +171,7 @@ export class Modal extends Component<Props> {
{(m, isVisible, isAnimated) => ( {(m, isVisible, isAnimated) => (
<Container isVisible={isVisible} onClick={preventBackdropClick ? undefined : onClose}> <Container isVisible={isVisible} onClick={preventBackdropClick ? undefined : onClose}>
<Backdrop op={m.opacity} /> <Backdrop op={m.opacity} />
<GrowScroll <GrowScroll alignItems="center" full justifyContent="center" style={{ height: '100%' }}>
alignItems="center"
full
justifyContent="flex-start"
style={{ height: '100%' }}
>
<Wrapper <Wrapper
op={m.opacity} op={m.opacity}
scale={m.scale} scale={m.scale}

7
src/components/layout/Print.js

@ -31,12 +31,13 @@ class Print extends PureComponent<any> {
if (!data) { if (!data) {
return null return null
} }
const { address, amount } = data const { address, amount, accountName } = data
return ( return (
<CurrentAddress <CurrentAddress
innerRef={n => (this._node = n)} accountName={accountName}
amount={amount}
address={address} address={address}
amount={amount}
innerRef={n => (this._node = n)}
withQRCode withQRCode
/> />
) )

6
src/components/modals/Receive/04-step-receive-funds.js

@ -8,7 +8,6 @@ import type { T } from 'types/common'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import CurrentAddress from 'components/CurrentAddress' import CurrentAddress from 'components/CurrentAddress'
import Label from 'components/base/Label' import Label from 'components/base/Label'
import SelectAccount from 'components/SelectAccount'
import RequestAmount from 'components/RequestAmount' import RequestAmount from 'components/RequestAmount'
type Props = { type Props = {
@ -22,10 +21,6 @@ type Props = {
export default (props: Props) => ( export default (props: Props) => (
<Box flow={5}> <Box flow={5}>
<Box flow={1}>
<Label>{props.t('receive:steps.chooseAccount.label')}</Label>
<SelectAccount disabled value={props.account} />
</Box>
<Box flow={1}> <Box flow={1}>
<Label>{props.t('receive:steps.receiveFunds.label')}</Label> <Label>{props.t('receive:steps.receiveFunds.label')}</Label>
<RequestAmount <RequestAmount
@ -36,6 +31,7 @@ export default (props: Props) => (
/> />
</Box> </Box>
<CurrentAddress <CurrentAddress
accountName={props.account && props.account.name}
address={props.account && props.account.address} address={props.account && props.account.address}
addressVerified={props.addressVerified} addressVerified={props.addressVerified}
amount={props.amount} amount={props.amount}

1
static/i18n/en/currentAddress.yml

@ -1 +1,2 @@
label: Current address label: Current address
labelFrom: Address from <1><0>{{accountName}}</0></1>

Loading…
Cancel
Save