From aad05a38511a8bdd9bd13d2d38092ce6b35ac46b Mon Sep 17 00:00:00 2001 From: Tayane Fernandes Date: Thu, 9 Mar 2017 18:54:10 -0300 Subject: [#923] Disable button when the email is invalid on the backup email page with @FrailWords --- web-ui/src/common/submit_button/submit_button.js | 14 +++++++++++--- web-ui/src/common/submit_button/submit_button.scss | 7 ------- web-ui/src/common/submit_button/submit_button.spec.js | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'web-ui/src/common/submit_button') diff --git a/web-ui/src/common/submit_button/submit_button.js b/web-ui/src/common/submit_button/submit_button.js index 4754e042..1e7da021 100644 --- a/web-ui/src/common/submit_button/submit_button.js +++ b/web-ui/src/common/submit_button/submit_button.js @@ -16,15 +16,23 @@ */ import React from 'react'; +import RaisedButton from 'material-ui/RaisedButton'; import './submit_button.scss'; -const SubmitButton = ({ buttonText }) => ( - +const SubmitButton = ({ buttonText, disabled }) => ( +
+ +
); SubmitButton.propTypes = { - buttonText: React.PropTypes.string.isRequired + buttonText: React.PropTypes.string.isRequired, + disabled: React.PropTypes.boolean +}; + +SubmitButton.defaultProps = { + disabled: true }; export default SubmitButton; diff --git a/web-ui/src/common/submit_button/submit_button.scss b/web-ui/src/common/submit_button/submit_button.scss index 13cb7607..ac1307a8 100644 --- a/web-ui/src/common/submit_button/submit_button.scss +++ b/web-ui/src/common/submit_button/submit_button.scss @@ -18,13 +18,6 @@ @import "~scss/base/colors"; .submit-button { - background: $dark_blue; - padding: 0.8em; - color: $white; - text-align: center; - border: none; - border-radius: 2px; - font-weight: 300; width: 100%; margin-bottom: 1em; } diff --git a/web-ui/src/common/submit_button/submit_button.spec.js b/web-ui/src/common/submit_button/submit_button.spec.js index 8279547c..d4308e6d 100644 --- a/web-ui/src/common/submit_button/submit_button.spec.js +++ b/web-ui/src/common/submit_button/submit_button.spec.js @@ -11,6 +11,6 @@ describe('SubmitButton', () => { }); it('renders an input of type submit for add email', () => { - expect(submitButton.find('input[type="submit"]').props().value).toEqual('Add Email'); + expect(submitButton.find('RaisedButton').props().label).toEqual('Add Email'); }); }); -- cgit v1.2.3 From 29a59d4ec216a895c8004fc0addbec1b329df200 Mon Sep 17 00:00:00 2001 From: Tayane Fernandes Date: Fri, 10 Mar 2017 14:29:27 -0300 Subject: [#923] Fix submit button style of material-ui with @FrailWords --- web-ui/src/common/submit_button/submit_button.js | 26 ++++++++++++++++++---- web-ui/src/common/submit_button/submit_button.scss | 1 + .../src/common/submit_button/submit_button.spec.js | 4 ++++ 3 files changed, 27 insertions(+), 4 deletions(-) (limited to 'web-ui/src/common/submit_button') diff --git a/web-ui/src/common/submit_button/submit_button.js b/web-ui/src/common/submit_button/submit_button.js index 1e7da021..73f9b21c 100644 --- a/web-ui/src/common/submit_button/submit_button.js +++ b/web-ui/src/common/submit_button/submit_button.js @@ -20,19 +20,37 @@ import RaisedButton from 'material-ui/RaisedButton'; import './submit_button.scss'; -const SubmitButton = ({ buttonText, disabled }) => ( +const labelStyle = { + textTransform: 'none', + fontSize: '1em', + lineHeight: '48px' +}; + +const buttonStyle = { + height: '48px' +}; + +const SubmitButton = ({ buttonText, disabled=false }) => (
- +
); SubmitButton.propTypes = { buttonText: React.PropTypes.string.isRequired, - disabled: React.PropTypes.boolean + disabled: React.PropTypes.bool }; SubmitButton.defaultProps = { - disabled: true + disabled: false }; export default SubmitButton; diff --git a/web-ui/src/common/submit_button/submit_button.scss b/web-ui/src/common/submit_button/submit_button.scss index ac1307a8..851899f7 100644 --- a/web-ui/src/common/submit_button/submit_button.scss +++ b/web-ui/src/common/submit_button/submit_button.scss @@ -20,6 +20,7 @@ .submit-button { width: 100%; margin-bottom: 1em; + font-size: 1em; } @media only screen and (min-width : 500px) { diff --git a/web-ui/src/common/submit_button/submit_button.spec.js b/web-ui/src/common/submit_button/submit_button.spec.js index d4308e6d..0ba8137c 100644 --- a/web-ui/src/common/submit_button/submit_button.spec.js +++ b/web-ui/src/common/submit_button/submit_button.spec.js @@ -13,4 +13,8 @@ describe('SubmitButton', () => { it('renders an input of type submit for add email', () => { expect(submitButton.find('RaisedButton').props().label).toEqual('Add Email'); }); + + it('renders button in enabled state', () => { + expect(submitButton.find('RaisedButton').props().disabled).toEqual(false); + }); }); -- cgit v1.2.3 From 9e5dce775c51b44cf7b17d8ab564fdefc16a06c0 Mon Sep 17 00:00:00 2001 From: Tayane Fernandes Date: Fri, 10 Mar 2017 15:25:43 -0300 Subject: [#923] Fix the submit button when the email is empty When the email is empty the button should be disabled, but we should not see any error message with @FrailWords --- web-ui/src/common/submit_button/submit_button.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'web-ui/src/common/submit_button') diff --git a/web-ui/src/common/submit_button/submit_button.js b/web-ui/src/common/submit_button/submit_button.js index 73f9b21c..1224c7bd 100644 --- a/web-ui/src/common/submit_button/submit_button.js +++ b/web-ui/src/common/submit_button/submit_button.js @@ -30,9 +30,10 @@ const buttonStyle = { height: '48px' }; -const SubmitButton = ({ buttonText, disabled=false }) => ( +const SubmitButton = ({ buttonText, disabled = false }) => (
-