fix: set color based on theme (#37634)

This commit is contained in:
Ahmad Abdolsaheb
2019-10-31 20:29:47 +03:00
committed by mrugesh
parent d8c89c99d8
commit 8f73a92e16
2 changed files with 12 additions and 5 deletions

View File

@ -25,7 +25,8 @@ const propTypes = {
isSignedIn: PropTypes.bool, isSignedIn: PropTypes.bool,
stripe: PropTypes.shape({ stripe: PropTypes.shape({
createToken: PropTypes.func.isRequired createToken: PropTypes.func.isRequired
}) }),
theme: PropTypes.string
}; };
const initialState = { const initialState = {
donationAmount: 500, donationAmount: 500,
@ -39,7 +40,7 @@ const initialState = {
const mapStateToProps = createSelector( const mapStateToProps = createSelector(
userSelector, userSelector,
isSignedInSelector, isSignedInSelector,
({ email }, isSignedIn) => ({ email, isSignedIn }) ({ email, theme }, isSignedIn) => ({ email, theme, isSignedIn })
); );
class DonateForm extends Component { class DonateForm extends Component {
@ -168,6 +169,7 @@ class DonateForm extends Component {
renderDonateForm() { renderDonateForm() {
const { isFormValid } = this.state; const { isFormValid } = this.state;
const { theme } = this.props;
return ( return (
<Row> <Row>
<Col sm={10} smOffset={1} xs={12}> <Col sm={10} smOffset={1} xs={12}>
@ -184,7 +186,10 @@ class DonateForm extends Component {
value={this.getUserEmail()} value={this.getUserEmail()}
/> />
</FormGroup> </FormGroup>
<StripeCardForm getValidationState={this.getValidationState} /> <StripeCardForm
getValidationState={this.getValidationState}
theme={theme}
/>
<Button <Button
block={true} block={true}
bsStyle='primary' bsStyle='primary'

View File

@ -10,12 +10,12 @@ import { ControlLabel, FormGroup } from '@freecodecamp/react-bootstrap';
import '../Donation.css'; import '../Donation.css';
const propTypes = { const propTypes = {
getValidationState: PropTypes.func.isRequired getValidationState: PropTypes.func.isRequired,
theme: PropTypes.string
}; };
const style = { const style = {
base: { base: {
color: '#0a0a23',
fontSize: '18px' fontSize: '18px'
} }
}; };
@ -74,6 +74,8 @@ class StripeCardForm extends Component {
} }
render() { render() {
// set color based on theme
style.base.color = this.props.theme === 'night' ? '#fff' : '#0a0a23';
return ( return (
<div className='donation-elements'> <div className='donation-elements'>
<FormGroup> <FormGroup>