From 8289af6721ed1c2d7b3eb9a52113c24da3c79a5f Mon Sep 17 00:00:00 2001 From: George Lima Date: Wed, 19 Dec 2018 18:39:10 -0300 Subject: [PATCH 01/32] feature: add chevron assets --- app/assets/images/chevron-down.svg | 1 + app/assets/images/chevron-up.svg | 1 + 2 files changed, 2 insertions(+) create mode 100644 app/assets/images/chevron-down.svg create mode 100644 app/assets/images/chevron-up.svg diff --git a/app/assets/images/chevron-down.svg b/app/assets/images/chevron-down.svg new file mode 100644 index 0000000..0794c73 --- /dev/null +++ b/app/assets/images/chevron-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/images/chevron-up.svg b/app/assets/images/chevron-up.svg new file mode 100644 index 0000000..dfff4e4 --- /dev/null +++ b/app/assets/images/chevron-up.svg @@ -0,0 +1 @@ + \ No newline at end of file From 6051113beaa5db6f6e0a695cff3b0f7d41ed437b Mon Sep 17 00:00:00 2001 From: George Lima Date: Wed, 19 Dec 2018 18:39:46 -0300 Subject: [PATCH 02/32] feature: add selectButtonShadow color --- app/theme.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/theme.js b/app/theme.js index f6c816a..8d98df9 100644 --- a/app/theme.js +++ b/app/theme.js @@ -23,6 +23,7 @@ const transactionSent = '#FF6C6C'; const transactionReceived = '#6AEAC0'; const transactionsDate = '#777777'; const transactionsItemHovered = '#222222'; +const selectButtonShadow = '#EEC94C'; const appTheme = { mode: DARK, @@ -61,11 +62,14 @@ const appTheme = { transactionReceived, transactionsDate, transactionsItemHovered, + inputBackground: brandOne, + selectButtonShadow, }, sidebarWidth: '200px', headerHeight: '60px', layoutPaddingLeft: '50px', layoutPaddingRight: '45px', + layoutContentPaddingTop: '20px', }; export const GlobalStyle = createGlobalStyle` From 243a645febfb736b3d908a4a5013e6b14e9fac21 Mon Sep 17 00:00:00 2001 From: George Lima Date: Wed, 19 Dec 2018 18:40:24 -0300 Subject: [PATCH 03/32] feature: add InputLabel --- app/components/input-label.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app/components/input-label.js diff --git a/app/components/input-label.js b/app/components/input-label.js new file mode 100644 index 0000000..bc93b52 --- /dev/null +++ b/app/components/input-label.js @@ -0,0 +1,9 @@ +// @flow +import styled from 'styled-components'; + +import { TextComponent } from './text'; + +export const InputLabelComponent = styled(TextComponent)` + margin: 20px 0 5px 0; + font-weight: ${props => props.theme.fontWeight.bold}; +`; From e43282124abc785b786d32e28c9b2ca637b6a8e3 Mon Sep 17 00:00:00 2001 From: George Lima Date: Wed, 19 Dec 2018 18:40:39 -0300 Subject: [PATCH 04/32] hotfix: remove useless margin top --- app/components/wallet-summary.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/wallet-summary.js b/app/components/wallet-summary.js index 63816e0..cccb535 100644 --- a/app/components/wallet-summary.js +++ b/app/components/wallet-summary.js @@ -17,8 +17,8 @@ const Wrapper = styled.div` background-color: ${props => props.theme.colors.cardBackgroundColor}; border-radius: 5px; padding: 37px 45px; - margin-top: 20px; position: relative; + margin-top: ${props => props.theme.layoutContentPaddingTop}; `; const AllAddresses = styled(TextComponent)` From 56acd17efa1c3e332a3c6f83fe619719a7ce89a2 Mon Sep 17 00:00:00 2001 From: George Lima Date: Wed, 19 Dec 2018 18:41:00 -0300 Subject: [PATCH 05/32] feature: add Select component --- app/components/select.js | 137 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 app/components/select.js diff --git a/app/components/select.js b/app/components/select.js new file mode 100644 index 0000000..3d6b64e --- /dev/null +++ b/app/components/select.js @@ -0,0 +1,137 @@ +// @flow +import React, { PureComponent } from 'react'; +import styled from 'styled-components'; + +import { TextComponent } from './text'; +import ChevronUp from '../assets/images/chevron-up.svg'; +import ChevronDown from '../assets/images/chevron-down.svg'; + +const SelectWrapper = styled.div` + display: flex; + flex-direction: row; + border-radius: 6px; + border: none; + background-color: ${// $FlowFixMe + props => props.theme.colors.inputBackground}; + color: ${// $FlowFixMe + props => props.theme.colors.text}; + width: 100%; + outline: none; + font-family: ${// $FlowFixMe + props => props.theme.fontFamily}; + cursor: pointer; + position: relative; +`; + +const ValueWrapper = styled.div` + width: 95%; + padding: 15px; + opacity: ${props => (props.hasValue ? '1' : '0.2')}; +`; + +const SelectMenuButtonWrapper = styled.button` + cursor: pointer; + outline: none; + border: none; + background-color: transparent; + width: 50px; + height: 100%; + padding: 15px; + border-left: ${props => `1px solid ${props.theme.colors.background}`}; +`; +/* eslint-disable max-len */ +const SelectMenuButton = styled.button` + outline: none; + background-color: transparent; + border: 1px solid ${props => props.theme.colors.text}; + border-radius: 100%; + box-shadow: ${props => `0px 0px 10px 0px ${props.theme.colors.selectButtonShadow}`}; +`; +/* eslint-enable max-len */ + +const Icon = styled.img` + width: 10px; + height: 10px; +`; + +const OptionsWrapper = styled.div` + display: flex; + flex-direction: column; + position: absolute; + width: 100%; + bottom: ${props => `-${props.optionsAmount * 60}px`}; +`; + +const Option = styled.button` + border: none; + background: none; + height: 60px; + background-color: ${props => props.theme.colors.inputBackground}; + cursor: pointer; + z-index: 99; + + &:hover { + background-color: ${props => props.theme.colors.background}; + } +`; + +type Props = { + value: string, + options: { value: string, label: string }[], + placeholder?: string, + onChange: string => void, +}; +type State = { + isOpen: boolean, +}; + +export class SelectComponent extends PureComponent { + state = { + isOpen: false, + }; + + static defaultProps = { + placeholder: null, + }; + + onSelect = (value: string) => { + const { onChange } = this.props; + + this.setState(() => ({ isOpen: false }), () => onChange(value)); + }; + + handleClickOutside = (event: Object) => { + const { isOpen } = this.state; + if (isOpen && event.target.id !== 'select-options-wrapper') this.setState(() => ({ isOpen: false })); + }; + + render() { + const { value, options, placeholder } = this.props; + const { isOpen } = this.state; + + return ( + this.setState(() => ({ isOpen: !isOpen }))}> + + {value || placeholder} + + + + + + + {isOpen && ( + + {options.map(({ label, value: optionValue }) => ( + + ))} + + )} + + ); + } +} From dedb3380d5f2881e725c0606d09c156947cd1b45 Mon Sep 17 00:00:00 2001 From: George Lima Date: Wed, 19 Dec 2018 18:41:16 -0300 Subject: [PATCH 06/32] hotfix: remove dropdown option from input --- app/components/input.js | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/app/components/input.js b/app/components/input.js index 3e61a97..3992bc1 100644 --- a/app/components/input.js +++ b/app/components/input.js @@ -3,30 +3,29 @@ import React from 'react'; import styled from 'styled-components'; -// TODO: Missing styles - -const defaultStyles = ` - padding: 10px; +const getDefaultStyles = t => styled[t]` + border-radius: 6px; + border: none; + background-color: ${// $FlowFixMe + props => props.theme.colors.inputBackground}; + color: ${// $FlowFixMe + props => props.theme.colors.text}; + padding: 15px; width: 100%; outline: none; - font-family: ${ - // $FlowFixMe - props => props.theme.fontFamily -} + font-family: ${// $FlowFixMe + props => props.theme.fontFamily}; + + ::placeholder { + opacity: 0.5; + } `; -const Input = styled.input.attrs({ - type: 'text', -})` - ${defaultStyles}; -`; - -const Textarea = styled.textarea` - ${defaultStyles}; -`; +const Input = getDefaultStyles('input'); +const Textarea = getDefaultStyles('textarea'); type Props = { - inputType?: 'input' | 'textarea' | 'dropdown', + inputType?: 'input' | 'textarea', value: string, onChange: string => void, rows?: number, @@ -42,7 +41,6 @@ export const InputComponent = ({ inputType, onChange, ...props }: Props) => { textarea: () => (