forked from scandipwa/scandipwa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scandipwa#3780 - Create confirm newsletter subscription page
- Loading branch information
1 parent
2e50918
commit b403255
Showing
25 changed files
with
386 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
packages/scandipwa/src/route/ConfirmNewsletterPage/ConfirmNewsletterPage.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/** | ||
* ScandiPWA - Progressive Web App for Magento | ||
* | ||
* Copyright © Scandiweb, Inc. All rights reserved. | ||
* See LICENSE for license details. | ||
* | ||
* @license OSL-3.0 (Open Software License ("OSL") v. 3.0) | ||
* @package scandipwa/scandipwa | ||
* @link https://github.com/scandipwa/scandipwa | ||
*/ | ||
|
||
import PropTypes from 'prop-types'; | ||
import { PureComponent } from 'react'; | ||
|
||
import ContentWrapper from 'Component/ContentWrapper'; | ||
import Link from 'Component/Link'; | ||
|
||
import { FAILED_STATUS, SUCCESS_STATUS } from './ConfirmNewsletterPage.config'; | ||
|
||
import './ConfirmNewsletterPage.style'; | ||
|
||
/** @namespace Route/ConfirmNewsletterPage/Component */ | ||
export class ConfirmNewsletterPage extends PureComponent { | ||
static propTypes = { | ||
status: PropTypes.string.isRequired, | ||
message: PropTypes.string.isRequired, | ||
shouldDisplayWarning: PropTypes.bool.isRequired | ||
}; | ||
|
||
renderWarningMessage() { | ||
const { status, message, shouldDisplayWarning } = this.props; | ||
|
||
if (!shouldDisplayWarning && status !== FAILED_STATUS) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div block="ConfirmNewsletterPage" elem="WarningMsg"> | ||
<h2> | ||
{ __('Unable to confirm subscrabition') } | ||
</h2> | ||
<div> | ||
{ message } | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
renderButtons() { | ||
return ( | ||
<div block="ConfirmNewsletterPage" elem="ButtonWrapper"> | ||
<Link | ||
block="Button" | ||
mix={ { block: 'ConfirmNewsletterPage', elem: 'ContinueButton' } } | ||
to="/" | ||
> | ||
{ __('Continue shopping') } | ||
</Link> | ||
</div> | ||
); | ||
} | ||
|
||
renderPageContents() { | ||
const { status, message, shouldDisplayWarning } = this.props; | ||
|
||
if (shouldDisplayWarning || status !== SUCCESS_STATUS) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<h1 block="ConfirmNewsletterPage" elem="Heading"> | ||
{ message } | ||
</h1> | ||
<h3 block="ConfirmNewsletterPage" elem="Message"> | ||
{ __('Thank you for subscribing to our newsletter!') } | ||
</h3> | ||
{ this.renderButtons() } | ||
</> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<main block="ConfirmNewsletterPage" aria-label={ __('Confirm Newsletter Page') }> | ||
<ContentWrapper | ||
wrapperMix={ { block: 'ConfirmNewsletterPage', elem: 'Wrapper' } } | ||
> | ||
{ this.renderWarningMessage() } | ||
{ this.renderPageContents() } | ||
</ContentWrapper> | ||
</main> | ||
); | ||
} | ||
} | ||
|
||
export default ConfirmNewsletterPage; |
13 changes: 13 additions & 0 deletions
13
packages/scandipwa/src/route/ConfirmNewsletterPage/ConfirmNewsletterPage.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* ScandiPWA - Progressive Web App for Magento | ||
* | ||
* Copyright © Scandiweb, Inc. All rights reserved. | ||
* See LICENSE for license details. | ||
* | ||
* @license OSL-3.0 (Open Software License ("OSL") v. 3.0) | ||
* @package scandipwa/scandipwa | ||
* @link https://github.com/scandipwa/scandipwa | ||
*/ | ||
|
||
export const SUCCESS_STATUS = 'success'; | ||
export const FAILED_STATUS = 'failed'; |
Oops, something went wrong.