feat(donate): remove themes from donate pages

This commit is contained in:
Mrugesh Mohapatra
2019-11-15 01:35:21 +05:30
parent ef0a801c90
commit f737b24b6f
3 changed files with 18 additions and 11 deletions

View File

@ -26,8 +26,7 @@ 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 = {
donationState: { donationState: {
@ -39,7 +38,7 @@ const initialState = {
const mapStateToProps = createSelector( const mapStateToProps = createSelector(
userSelector, userSelector,
({ email, theme }) => ({ email, theme }) ({ email }) => ({ email })
); );
class DonateFormChildViewForHOC extends Component { class DonateFormChildViewForHOC extends Component {
@ -176,7 +175,7 @@ class DonateFormChildViewForHOC extends Component {
renderDonateForm() { renderDonateForm() {
const { isFormValid } = this.state; const { isFormValid } = this.state;
const { theme, getDonationButtonLabel } = this.props; const { getDonationButtonLabel } = this.props;
return ( return (
<Form className='donation-form' onSubmit={this.handleSubmit}> <Form className='donation-form' onSubmit={this.handleSubmit}>
<FormGroup className='donation-email-container'> <FormGroup className='donation-email-container'>
@ -191,10 +190,7 @@ class DonateFormChildViewForHOC extends Component {
value={this.getUserEmail()} value={this.getUserEmail()}
/> />
</FormGroup> </FormGroup>
<StripeCardForm <StripeCardForm getValidationState={this.getValidationState} />
getValidationState={this.getValidationState}
theme={theme}
/>
<Button <Button
block={true} block={true}
bsStyle='primary' bsStyle='primary'

View File

@ -81,7 +81,8 @@ const propTypes = {
pathname: PropTypes.string.isRequired, pathname: PropTypes.string.isRequired,
removeFlashMessage: PropTypes.func.isRequired, removeFlashMessage: PropTypes.func.isRequired,
showFooter: PropTypes.bool, showFooter: PropTypes.bool,
theme: PropTypes.string theme: PropTypes.string,
useTheme: PropTypes.bool
}; };
const mapStateToProps = createSelector( const mapStateToProps = createSelector(
@ -145,13 +146,16 @@ class DefaultLayout extends Component {
isSignedIn, isSignedIn,
removeFlashMessage, removeFlashMessage,
showFooter = true, showFooter = true,
theme = 'default' theme = 'default',
useTheme = true
} = this.props; } = this.props;
return ( return (
<Fragment> <Fragment>
<Helmet <Helmet
bodyAttributes={{ bodyAttributes={{
class: `${theme === 'default' ? 'light-palette' : 'dark-palette'}` class: useTheme
? `${theme === 'default' ? 'light-palette' : 'dark-palette'}`
: 'light-palette'
}} }}
meta={[ meta={[
{ {

View File

@ -27,6 +27,13 @@ export default function layoutSelector({ element, props }) {
</DefaultLayout> </DefaultLayout>
); );
} }
if (/^\/donation(\/.*)*|^\/donate(\/.*)*/.test(pathname)) {
return (
<DefaultLayout pathname={pathname} useTheme={false}>
{element}
</DefaultLayout>
);
}
return <DefaultLayout pathname={pathname}>{element}</DefaultLayout>; return <DefaultLayout pathname={pathname}>{element}</DefaultLayout>;
} }