-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add age confirmation on web when setting mature content setting
- Loading branch information
Sean Yesmunt
committed
May 22, 2020
1 parent
6d888b5
commit 047fb24
Showing
7 changed files
with
100 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { connect } from 'react-redux'; | ||
import { doHideModal } from 'redux/actions/app'; | ||
import { doSetClientSetting } from 'redux/actions/settings'; | ||
import ModalAffirmPurchase from './view'; | ||
|
||
export default connect(null, { | ||
doHideModal, | ||
doSetClientSetting, | ||
})(ModalAffirmPurchase); |
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,52 @@ | ||
// @flow | ||
import * as SETTINGS from 'constants/settings'; | ||
import React from 'react'; | ||
import { Modal } from 'modal/modal'; | ||
import Card from 'component/common/card'; | ||
import Button from 'component/button'; | ||
import { FormField } from 'component/common/form'; | ||
|
||
type Props = { | ||
doHideModal: () => void, | ||
doSetClientSetting: (string, any) => void, | ||
}; | ||
|
||
function ModalAffirmPurchase(props: Props) { | ||
const { doHideModal, doSetClientSetting } = props; | ||
const [confirmed, setConfirmed] = React.useState(false); | ||
|
||
function handleConfirmAge() { | ||
doSetClientSetting(SETTINGS.SHOW_MATURE, true); | ||
doHideModal(); | ||
} | ||
|
||
const title = __('Confirm Your Age'); | ||
|
||
return ( | ||
<Modal type="card" isOpen contentLabel={title} onAborted={doHideModal}> | ||
<Card | ||
title={title} | ||
actions={ | ||
<> | ||
<div className="section"> | ||
<FormField | ||
name="age-confirmation" | ||
type="checkbox" | ||
label={__('I confirm I am over 18 years old.')} | ||
helper={__('This is only for regulatory compliance and the data will not be stored.')} | ||
checked={confirmed} | ||
onChange={() => setConfirmed(!confirmed)} | ||
/> | ||
</div> | ||
<div className="section__actions"> | ||
<Button button="primary" label={'Confirm'} onClick={handleConfirmAge} disabled={!confirmed} /> | ||
<Button button="link" label={__('Cancel')} onClick={doHideModal} /> | ||
</div> | ||
</> | ||
} | ||
/> | ||
</Modal> | ||
); | ||
} | ||
|
||
export default ModalAffirmPurchase; |
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