From 06b1d27e641875c3faa4fafa92d697124166d2f9 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Tue, 2 Oct 2018 20:39:34 +0200 Subject: [PATCH] fix(styles): clean up and standardize buttons Implement Button component throughout the app. Fix #830 --- app/components/Activity/Activity.js | 11 +-- app/components/Activity/Activity.scss | 19 ---- app/components/App/App.js | 6 +- .../Contacts/AddChannel/AddChannel.js | 7 +- .../Contacts/AddChannel/AddChannel.scss | 13 --- .../ConnectManually/ConnectManually.js | 8 +- .../ConnectManually/ConnectManually.scss | 22 ----- .../SubmitChannelForm/SubmitChannelForm.js | 8 +- .../SubmitChannelForm/SubmitChannelForm.scss | 21 ----- app/components/Form/Pay/Pay.js | 8 +- app/components/Form/Pay/Pay.scss | 22 ----- app/components/Form/Request/Request.js | 8 +- app/components/Form/Request/Request.scss | 22 ----- .../Onboarding/FormContainer/FormContainer.js | 16 ++-- .../FormContainer/FormContainer.scss | 28 +----- app/components/Onboarding/Login/Login.js | 29 +++--- app/components/Onboarding/Login/Login.scss | 70 +-------------- app/components/Onboarding/Login/messages.js | 3 +- app/components/Settings/Theme/Theme.js | 35 ++++---- app/components/Wallet/Wallet.js | 9 +- app/components/Wallet/Wallet.scss | 22 ----- app/containers/Activity.js | 12 ++- app/containers/App.js | 2 + app/containers/Root.js | 72 ++++++++------- app/index.js | 5 +- app/lib/lnd/subscribe/channelgraph.js | 4 +- app/reducers/index.js | 3 + app/reducers/settings.js | 23 +---- app/reducers/theme.js | 67 ++++++++++++++ app/styles/app.global.scss | 90 ------------------- app/translations/en.json | 5 ++ test/unit/components/Form/Pay.spec.js | 10 +-- .../__snapshots__/settings.spec.js.snap | 4 - 33 files changed, 214 insertions(+), 470 deletions(-) create mode 100644 app/reducers/theme.js diff --git a/app/components/Activity/Activity.js b/app/components/Activity/Activity.js index 8f164054..878346ff 100644 --- a/app/components/Activity/Activity.js +++ b/app/components/Activity/Activity.js @@ -6,7 +6,8 @@ import xIcon from 'icons/x.svg' import FaRepeat from 'react-icons/lib/fa/repeat' import { FormattedMessage, injectIntl } from 'react-intl' - +import { Flex } from 'rebass' +import Button from 'components/UI/Button' import Wallet from 'components/Wallet' import Invoice from './Invoice' import Payment from './Payment' @@ -217,15 +218,15 @@ class Activity extends Component { ))} {showExpiredToggle && currentActivity.length > 0 && ( - - + + {showExpiredRequests ? ( ) : ( )} - - + + )} diff --git a/app/components/Activity/Activity.scss b/app/components/Activity/Activity.scss index 03fa499f..f18b1b00 100644 --- a/app/components/Activity/Activity.scss +++ b/app/components/Activity/Activity.scss @@ -140,25 +140,6 @@ } } -.toggleExpired { - margin: 0 auto; - font-size: 14px; - font-weight: bold; - color: var(--primaryText); - background: var(--lightBackground); - padding: 10px 7.5px; - width: 200px; - text-align: center; - border-radius: 5px; - cursor: pointer; - opacity: 1; - transition: all 0.25s; - - &:hover { - opacity: 0.5; - } -} - .activity { position: relative; padding: 0 60px; diff --git a/app/components/App/App.js b/app/components/App/App.js index 096156fb..9ff46ce3 100644 --- a/app/components/App/App.js +++ b/app/components/App/App.js @@ -26,6 +26,7 @@ class App extends Component { render() { const { + currentTheme, currentTicker, form, @@ -41,8 +42,6 @@ class App extends Component { activityModalProps, channelFormProps, - settings, - children } = this.props @@ -51,7 +50,7 @@ class App extends Component { } return ( - + @@ -79,6 +78,7 @@ App.propTypes = { formProps: PropTypes.object.isRequired, closeForm: PropTypes.func.isRequired, error: PropTypes.object.isRequired, + currentTheme: PropTypes.string.isRequired, currentTicker: PropTypes.object, contactsFormProps: PropTypes.object, networkTabProps: PropTypes.object, diff --git a/app/components/Contacts/AddChannel/AddChannel.js b/app/components/Contacts/AddChannel/AddChannel.js index d6c42177..aa3c6dc7 100644 --- a/app/components/Contacts/AddChannel/AddChannel.js +++ b/app/components/Contacts/AddChannel/AddChannel.js @@ -5,8 +5,8 @@ import Isvg from 'react-inlinesvg' import x from 'icons/x.svg' import { FormattedMessage } from 'react-intl' +import Button from 'components/UI/Button' import messages from './messages' - import styles from './AddChannel.scss' const AddChannel = ({ @@ -145,9 +145,10 @@ const AddChannel = ({ - + + - + )} diff --git a/app/components/Contacts/AddChannel/AddChannel.scss b/app/components/Contacts/AddChannel/AddChannel.scss index 7cdc0d23..c3f0a01a 100644 --- a/app/components/Contacts/AddChannel/AddChannel.scss +++ b/app/components/Contacts/AddChannel/AddChannel.scss @@ -125,17 +125,4 @@ font-size: 14px; margin: 20px 0; } - - div { - background: var(--lightningOrange); - font-size: 16px; - padding: 10px; - cursor: pointer; - transition: all 0.25s; - border-radius: 5px; - - &:hover { - opacity: 0.75; - } - } } diff --git a/app/components/Contacts/ConnectManually/ConnectManually.js b/app/components/Contacts/ConnectManually/ConnectManually.js index 7cb5e805..1352ca49 100644 --- a/app/components/Contacts/ConnectManually/ConnectManually.js +++ b/app/components/Contacts/ConnectManually/ConnectManually.js @@ -2,6 +2,7 @@ import React from 'react' import PropTypes from 'prop-types' import { FormattedMessage, injectIntl } from 'react-intl' +import Button from 'components/UI/Button' import messages from './messages' import styles from './ConnectManually.scss' @@ -81,12 +82,9 @@ class ConnectManually extends React.Component { - + - + ) diff --git a/app/components/Contacts/ConnectManually/ConnectManually.scss b/app/components/Contacts/ConnectManually/ConnectManually.scss index d3c418ef..938c9f2c 100644 --- a/app/components/Contacts/ConnectManually/ConnectManually.scss +++ b/app/components/Contacts/ConnectManually/ConnectManually.scss @@ -100,26 +100,4 @@ .submit { margin-top: 50px; text-align: center; - - .button { - width: 235px; - margin: 0 auto; - padding: 20px 10px; - background: #31343f; - opacity: 0.5; - cursor: pointer; - transition: 0.25s all; - - &.active { - background: var(--lightningOrange); - color: var(--white); - font-weight: bold; - opacity: 1; - transition: all 0.25s; - - &:hover { - opacity: 0.75; - } - } - } } diff --git a/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.js b/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.js index ffe67632..bc807254 100644 --- a/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.js +++ b/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.js @@ -5,6 +5,7 @@ import FaAngleDown from 'react-icons/lib/fa/angle-down' import FaExclamationCircle from 'react-icons/lib/fa/exclamation-circle' import AmountInput from 'components/AmountInput' +import Button from 'components/UI/Button' import { FormattedNumber, FormattedMessage } from 'react-intl' import messages from './messages' @@ -155,12 +156,9 @@ class SubmitChannelForm extends React.Component { - 0 ? styles.active : undefined}`} - onClick={formSubmitted} - > + 0)} onClick={formSubmitted} size="large"> - + ) diff --git a/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.scss b/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.scss index 46f177e6..ab7cc6ba 100644 --- a/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.scss +++ b/app/components/Contacts/SubmitChannelForm/SubmitChannelForm.scss @@ -145,25 +145,4 @@ .submit { margin-top: 50px; text-align: center; - - .button { - width: 235px; - margin: 0 auto; - padding: 20px 10px; - background: var(--lightBackground); - opacity: 0.5; - cursor: pointer; - transition: 0.25s all; - - &.active { - background: var(--lightningOrange); - color: var(--white); - font-weight: bold; - opacity: 1; - - &:hover { - opacity: 0.5; - } - } - } } diff --git a/app/components/Form/Pay/Pay.js b/app/components/Form/Pay/Pay.js index a817f030..bfc34453 100644 --- a/app/components/Form/Pay/Pay.js +++ b/app/components/Form/Pay/Pay.js @@ -8,6 +8,7 @@ import FaAngleDown from 'react-icons/lib/fa/angle-down' import { btc } from 'lib/utils' import AmountInput from 'components/AmountInput' +import Button from 'components/UI/Button' import { FormattedNumber, FormattedMessage, injectIntl } from 'react-intl' import messages from './messages' @@ -203,12 +204,9 @@ class Pay extends Component { - + - + diff --git a/app/components/Form/Pay/Pay.scss b/app/components/Form/Pay/Pay.scss index 44302779..422fa3e5 100644 --- a/app/components/Form/Pay/Pay.scss +++ b/app/components/Form/Pay/Pay.scss @@ -155,28 +155,6 @@ .submit { margin-top: 20px; text-align: center; - - .button { - width: 200px; - margin: 0 auto; - padding: 15px 7.5px; - background: var(--lightBackground); - border-radius: 5px; - opacity: 0.5; - cursor: pointer; - transition: 0.25s all; - - &.active { - background: var(--lightningOrange); - color: var(--white); - font-weight: bold; - opacity: 1; - - &:hover { - // background: darken(var(--lightningOrange), 5%); - } - } - } } } diff --git a/app/components/Form/Request/Request.js b/app/components/Form/Request/Request.js index 82e50010..037025f8 100644 --- a/app/components/Form/Request/Request.js +++ b/app/components/Form/Request/Request.js @@ -7,6 +7,7 @@ import FaAngleDown from 'react-icons/lib/fa/angle-down' import { btc } from 'lib/utils' import AmountInput from 'components/AmountInput' +import Button from 'components/UI/Button' import { FormattedNumber, FormattedMessage, injectIntl } from 'react-intl' import messages from './messages' @@ -109,12 +110,9 @@ const Request = ({ - 0 ? styles.active : undefined}`} - onClick={onRequestSubmit} - > + 0)} onClick={onRequestSubmit} size="large" width={200}> - + diff --git a/app/components/Form/Request/Request.scss b/app/components/Form/Request/Request.scss index bebec416..08fc7b49 100644 --- a/app/components/Form/Request/Request.scss +++ b/app/components/Form/Request/Request.scss @@ -134,27 +134,5 @@ .submit { margin-top: 50px; text-align: center; - - .button { - width: 200px; - margin: 0 auto; - padding: 15px 7.5px; - background: var(--lightBackground); - border-radius: 5px; - opacity: 0.5; - cursor: pointer; - transition: 0.25s all; - - &.active { - background: var(--lightningOrange); - color: var(--white); - font-weight: bold; - opacity: 1; - - &:hover { - opacity: 0.75; - } - } - } } } diff --git a/app/components/Onboarding/FormContainer/FormContainer.js b/app/components/Onboarding/FormContainer/FormContainer.js index 28fecab7..b1008247 100644 --- a/app/components/Onboarding/FormContainer/FormContainer.js +++ b/app/components/Onboarding/FormContainer/FormContainer.js @@ -5,7 +5,7 @@ import Isvg from 'react-inlinesvg' import FaAngleLeft from 'react-icons/lib/fa/angle-left' import FaAngleRight from 'react-icons/lib/fa/angle-right' - +import Button from 'components/UI/Button' import zapLogo from 'icons/zap-logo.svg' import { FormattedMessage } from 'react-intl' import zapLogoBlack from 'icons/zap-logo-black.svg' @@ -42,18 +42,18 @@ const FormContainer = ({ title, description, back, next, children, theme }) => ( {back && ( - - {' '} + + - + )} {next && ( - - {' '} - - + + + + )} diff --git a/app/components/Onboarding/FormContainer/FormContainer.scss b/app/components/Onboarding/FormContainer/FormContainer.scss index 5ef25263..6cf1a21e 100644 --- a/app/components/Onboarding/FormContainer/FormContainer.scss +++ b/app/components/Onboarding/FormContainer/FormContainer.scss @@ -3,7 +3,7 @@ .container { position: relative; height: 100vh; - background: var(--darkestBackground); + background: var(--lightBackground); } .titleBar { @@ -51,7 +51,7 @@ .content { position: relative; - background: var(--lightBackground); + background: var(--darkestBackground); height: 100vh; padding: 40px 40px; } @@ -67,29 +67,5 @@ display: flex; flex-direction: row; justify-content: space-between; - - .nextButton { - cursor: pointer; - transition: all 0.25s; - background: var(--lightningOrange); - padding: 8px 20px 8px 30px; - text-align: center; - border-radius: 5px; - - &:hover { - opacity: 0.5; - } - } - - .backButton { - cursor: pointer; - transition: all 0.25s; - padding: 8px 20px 8px 0; - text-align: center; - - &:hover { - opacity: 0.5; - } - } } } diff --git a/app/components/Onboarding/Login/Login.js b/app/components/Onboarding/Login/Login.js index 4e0d53ff..4461064f 100644 --- a/app/components/Onboarding/Login/Login.js +++ b/app/components/Onboarding/Login/Login.js @@ -1,11 +1,13 @@ import React from 'react' import PropTypes from 'prop-types' import { FormattedMessage, injectIntl } from 'react-intl' +import Button from 'components/UI/Button' import messages from './messages' import styles from './Login.scss' const Login = ({ password, + passwordIsValid, updatePassword, unlockingWallet, unlockWallet, @@ -31,26 +33,25 @@ const Login = ({