-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
105 additions
and
79 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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './Button.sass'; | ||
|
||
const Button = (props) => ( | ||
const Button = ({ children, onClick }) => ( | ||
<button | ||
children={props.children} | ||
children={children} | ||
className={styles.Button} | ||
onClick={props.onClick} | ||
onClick={onClick} | ||
/> | ||
); | ||
|
||
Button.propTypes = { | ||
children: PropTypes.string.isRequired, | ||
onClick: PropTypes.func.isRequired | ||
} | ||
|
||
export default Button; |
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,16 +1,33 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './SelectInput.sass'; | ||
|
||
const SelectInput = (props) => ( | ||
<div className={styles.SelectInput} style={{width: props.width, marginRight: props.marginRight}}> | ||
<label>{props.label}</label> | ||
<select name={props.name} onChange={props.onChange}> | ||
<option value="">{props.placeholder}</option> | ||
{props.options && props.options.length > 0 && props.options.map(opt => { | ||
return <option key={opt.id} value={opt.id} selected={props.value === opt.id}>{opt.name}</option> | ||
})} | ||
const SelectInput = ({ label, name, placeholder, value, options, width, marginRight, onChange }) => ( | ||
<div className={styles.SelectInput} style={{ width, marginRight }}> | ||
<label>{label}</label> | ||
<select name={name} value={value} onChange={onChange}> | ||
<option value=''>{placeholder}</option> | ||
{options && options.length > 0 && options.map(option => ( | ||
<option key={option.id} value={option.id}>{option.name}</option> | ||
))} | ||
</select> | ||
</div> | ||
); | ||
|
||
SelectInput.propTypes = { | ||
label: PropTypes.string.isRequired, | ||
name: PropTypes.string, | ||
placeholder: PropTypes.string, | ||
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
options: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
name: PropTypes.string | ||
}) | ||
), | ||
width: PropTypes.string, | ||
marginRight: PropTypes.string, | ||
onChange: PropTypes.func.isRequired | ||
} | ||
|
||
export default SelectInput; |
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,12 +1,19 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './TextInput.sass'; | ||
|
||
const TextInput = (props) => { | ||
return ( | ||
<div className={styles.TextInput} style={{width: props.width, marginRight: props.marginRight}}> | ||
<input value={props.value} placeholder={props.placeholder} onChange={props.onChange} /> | ||
</div> | ||
); | ||
}; | ||
const TextInput = ({ value, placeholder, width, marginRight, onChange }) => ( | ||
<div className={styles.TextInput} style={{ width, marginRight }}> | ||
<input value={value} placeholder={placeholder} onChange={onChange} /> | ||
</div> | ||
); | ||
|
||
TextInput.propTypes = { | ||
value: PropTypes.string, | ||
placeholder: PropTypes.string, | ||
width: PropTypes.string, | ||
marginRight: PropTypes.string, | ||
onChange: PropTypes.func.isRequired | ||
} | ||
|
||
export default 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