-
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.
created checkbox component and wired up subscribed to mailing list
- Loading branch information
Showing
16 changed files
with
180 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { PureComponent } from 'react'; | ||
|
||
import PropTypes from 'prop-types'; | ||
|
||
import './Checkbox.css'; | ||
|
||
const greenCheckmark = require('./check.svg'); | ||
|
||
export default class Checkbox extends PureComponent { | ||
static propTypes = { | ||
onChange: PropTypes.func.isRequired, | ||
label: PropTypes.string.isRequired, | ||
id: PropTypes.string.isRequired, | ||
checked: PropTypes.bool.isRequired, | ||
}; | ||
|
||
static defaultProps = { | ||
checked: false, | ||
}; | ||
|
||
handleOnChange = ({ target: { checked } }) => { | ||
const { onChange } = this.props; | ||
|
||
onChange(checked); | ||
}; | ||
|
||
render() { | ||
const { id, checked, label } = this.props; | ||
|
||
return ( | ||
<label htmlFor={id} className={'Checkbox__container'}> | ||
<div className={'Checkbox__input-container'}> | ||
<input | ||
type={'checkbox'} | ||
className={'visuallyhidden'} | ||
id={id} | ||
onChange={this.handleOnChange} | ||
checked={checked} | ||
/> | ||
{checked && ( | ||
<img | ||
className={'Checkbox__check'} | ||
src={greenCheckmark} | ||
alt={'checked'} | ||
/> | ||
)} | ||
</div> | ||
<div className={'Checkbox_label'}>{label}</div> | ||
</label> | ||
); | ||
} | ||
} |
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,27 @@ | ||
.Checkbox__container { | ||
display: flex; | ||
} | ||
|
||
.Checkbox__input-container { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
flex-shrink: 0; | ||
width: 34px; | ||
height: 34px; | ||
background-color: #F7F7F7; | ||
border-radius: 5px; | ||
border: 2px solid #F1F1F1; | ||
} | ||
|
||
.Checkbox_label { | ||
color: #333; | ||
font-size: 1.4rem; | ||
margin-left: 10px; | ||
} | ||
|
||
.Checkbox__check { | ||
width: 18px; | ||
height: 14px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
export { default as Checkbox } from "./Checkbox.component"; |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export * from "./Completed"; | ||
export * from "./CompletedHeader"; | ||
export * from "./CompletedResultsList"; | ||
export * from "./Results"; | ||
export * from './Completed'; | ||
export * from './CompletedHeader'; | ||
export * from './CompletedResultsList'; | ||
export * from './Results'; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./EmailCapture"; | ||
export * from "./EmailCaptureContinueButton"; | ||
export * from "./EmailCaptureEmailInput"; | ||
export * from './EmailCapture'; | ||
export * from './EmailCaptureContinueButton'; | ||
export * from './EmailCaptureEmailInput'; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./NameCapture"; | ||
export * from "./NameCaptureContinueButton"; | ||
export * from "./NameCaptureNameInput"; | ||
export * from './NameCapture'; | ||
export * from './NameCaptureContinueButton'; | ||
export * from './NameCaptureNameInput'; |
22 changes: 22 additions & 0 deletions
22
src/components/SubscribeToMailingListCheckbox/SubscribeToMailingListCheckbox.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,22 @@ | ||
import React, { PureComponent } from "react"; | ||
|
||
import PropTypes from "prop-types"; | ||
|
||
import { Checkbox } from "src/components"; | ||
|
||
export default class SubscribeToMailingListCheckbox extends PureComponent { | ||
static propTypes = { | ||
onChange: PropTypes.func.isRequired, | ||
checked: PropTypes.bool.isRequired, | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Checkbox | ||
{...this.props} | ||
id='mailing-list-checkbox' | ||
label={`Yes, I would like to receive periodic updates from Dan Wilt Coaching.`} | ||
/> | ||
); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/components/SubscribeToMailingListCheckbox/SubscribeToMailingListCheckbox.container.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 @@ | ||
import { connect } from 'react-redux'; | ||
|
||
import { subscribedToMailingListSelector } from 'src/selectors'; | ||
|
||
import { toggleSubscribedToMailingListAction as onChange } from 'src/store/quiz/quiz.actions'; | ||
|
||
import SubscribeToMailingListCheckbox from './SubscribeToMailingListCheckbox.component'; | ||
|
||
export default connect((st) => ({ | ||
checked: subscribedToMailingListSelector(st), | ||
}), { | ||
onChange, | ||
})(SubscribeToMailingListCheckbox); |
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 @@ | ||
export { default as SubscribeToMailingListCheckbox } from './SubscribeToMailingListCheckbox.container'; |
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 |
---|---|---|
@@ -1,14 +1,16 @@ | ||
export * from "./ActionButton"; | ||
export * from "./ActivityIndicator"; | ||
export * from "./Answer"; | ||
export * from "./App"; | ||
export * from "./CodeFigure"; | ||
export * from "./Completed"; | ||
export * from "./EmailCapture"; | ||
export * from "./NameCapture"; | ||
export * from "./Question"; | ||
export * from "./QuestionAnswer"; | ||
export * from "./Quiz"; | ||
export * from "./QuizProgressIndicator"; | ||
export * from "./QuizQuestion"; | ||
export * from "./TextInput"; | ||
export * from './ActionButton'; | ||
export * from './ActivityIndicator'; | ||
export * from './Answer'; | ||
export * from './App'; | ||
export * from './Checkbox'; | ||
export * from './CodeFigure'; | ||
export * from './Completed'; | ||
export * from './EmailCapture'; | ||
export * from './NameCapture'; | ||
export * from './Question'; | ||
export * from './QuestionAnswer'; | ||
export * from './Quiz'; | ||
export * from './QuizProgressIndicator'; | ||
export * from './QuizQuestion'; | ||
export * from './SubscribeToMailingListCheckbox'; | ||
export * from './TextInput'; |
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