From 2b2b82a3ec28f57522a5dccdf6977bef06cb7cfc Mon Sep 17 00:00:00 2001 From: meriadec Date: Mon, 19 Mar 2018 13:54:20 +0100 Subject: [PATCH] Add Spoiler component & use it in send modal --- src/components/base/CheckBox/index.js | 1 + src/components/base/Input/index.js | 22 ++++++- src/components/base/Spoiler/index.js | 60 ++++++++++++++++++++ src/components/modals/Send/01-step-amount.js | 58 ++++++++++++++++++- src/components/modals/Send/index.js | 4 +- src/icons/ChevronRight.js | 10 ++++ src/styles/global.js | 6 +- static/i18n/en/send.yml | 2 + 8 files changed, 157 insertions(+), 6 deletions(-) create mode 100644 src/components/base/Spoiler/index.js create mode 100644 src/icons/ChevronRight.js diff --git a/src/components/base/CheckBox/index.js b/src/components/base/CheckBox/index.js index 86eea059..0898313e 100644 --- a/src/components/base/CheckBox/index.js +++ b/src/components/base/CheckBox/index.js @@ -16,6 +16,7 @@ const Base = styled(Tabbable).attrs({ height: 24px; border-radius: 16px; transition: 250ms linear background-color; + cursor: pointer; &:focus { box-shadow: rgba(0, 0, 0, 0.1) 0 2px 2px; outline: none; diff --git a/src/components/base/Input/index.js b/src/components/base/Input/index.js index 3cf31bb9..d686f75d 100644 --- a/src/components/base/Input/index.js +++ b/src/components/base/Input/index.js @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react' import styled from 'styled-components' -import { fontSize } from 'styled-system' +import { fontSize, space } from 'styled-system' import noop from 'lodash/noop' @@ -38,6 +38,26 @@ const Base = styled.input.attrs({ } ` +export const Textarea = styled.textarea.attrs({ + p: 2, + fontSize: 4, + ff: p => p.ff || 'Open Sans|SemiBold', +})` + ${space}; + ${fontFamily}; + ${fontSize}; + min-height: 80px; + color: ${p => p.theme.colors.dark}; + background: ${p => p.theme.colors.white}; + border-radius: 3px; + border: 1px solid ${p => p.theme.colors.fog}; + box-shadow: none; + &:focus { + box-shadow: rgba(0, 0, 0, 0.05) 0 2px 2px; + outline: none; + } +` + type Props = { keepEvent?: boolean, onBlur: Function, diff --git a/src/components/base/Spoiler/index.js b/src/components/base/Spoiler/index.js new file mode 100644 index 00000000..b076ce61 --- /dev/null +++ b/src/components/base/Spoiler/index.js @@ -0,0 +1,60 @@ +// @flow + +import React, { PureComponent, Fragment } from 'react' +import styled from 'styled-components' + +import Box from 'components/base/Box' +import Text from 'components/base/Text' +import IconChevronRight from 'icons/ChevronRight' + +type Props = { + children: any, + title: string, +} + +type State = { + isOpened: boolean, +} + +const Title = styled(Text).attrs({ + ff: 'Museo Sans|Bold', + fontSize: 2, + color: 'dark', + tabIndex: 0, +})` + text-transform: uppercase; + letter-spacing: 1px; + cursor: pointer; + outline: none; +` + +const IconContainer = styled(Box)` + transform: rotate(${p => (p.isOpened ? '90' : '0')}deg); + transition: 150ms linear transform; +` + +class Spoiler extends PureComponent { + state = { + isOpened: false, + } + + toggle = () => this.setState({ isOpened: !this.state.isOpened }) + + render() { + const { title, children } = this.props + const { isOpened } = this.state + return ( + + + + + + {title} + + {isOpened && children} + + ) + } +} + +export default Spoiler diff --git a/src/components/modals/Send/01-step-amount.js b/src/components/modals/Send/01-step-amount.js index 0ce36919..430ea4af 100644 --- a/src/components/modals/Send/01-step-amount.js +++ b/src/components/modals/Send/01-step-amount.js @@ -12,25 +12,35 @@ import LabelInfoTooltip from 'components/base/LabelInfoTooltip' import RecipientAddress from 'components/RecipientAddress' import RequestAmount from 'components/RequestAmount' import Select from 'components/base/Select' -import Input from 'components/base/Input' +import Input, { Textarea } from 'components/base/Input' +import Spoiler from 'components/base/Spoiler' +import CheckBox from 'components/base/CheckBox' type Props = { account: Account | null, onChange: Function, recipientAddress: string, amount: DoubleVal, + isRBF: boolean, t: T, } function StepAmount(props: Props) { - const { onChange, account, recipientAddress, t, amount } = props + const { onChange, account, recipientAddress, t, amount, isRBF } = props return ( + {/* */} + {/* ACCOUNT SELECTION */} + {/* */} + + {/* */} + {/* RECIPIENT ADDRESS */} + {/* */} + {account && ( + {/* */} + {/* AMOUNT */} + {/* */} + + {/* */} + {/* FEES */} + {/* */} + + {/* */} + {/* ADVANCED OPTIONS */} + {/* */} + + {/* */} + {/* RBF transaction */} + {/* */} + + + + + + + + + + {/* */} + {/* Message */} + {/* */} + + + + + +