👌 fixed warnings
This commit is contained in:
parent
3ce0a51c49
commit
82ec5207cb
2 changed files with 23 additions and 16 deletions
|
@ -65,7 +65,7 @@ Header.propTypes = {
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
subtitle: PropTypes.string,
|
subtitle: PropTypes.string,
|
||||||
leftButton: PropTypes.element,
|
leftButton: PropTypes.element,
|
||||||
children: PropTypes.arrayOf(PropTypes.element),
|
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]),
|
||||||
transparent: PropTypes.bool
|
transparent: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,34 +18,41 @@ const OptionLabel = styled.label.attrs({ className: 'preference__option' })`
|
||||||
font-size: ${remSize(14)} !important;
|
font-size: ${remSize(14)} !important;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Selector = ({
|
const PreferencePicker = ({
|
||||||
title, value, onSelect, options,
|
title, value, onSelect, options,
|
||||||
}) => (
|
}) => (
|
||||||
<Preference>
|
<Preference>
|
||||||
<PreferenceTitle>{title}</PreferenceTitle>
|
<PreferenceTitle>{title}</PreferenceTitle>
|
||||||
<div className="preference__options">
|
<div className="preference__options">
|
||||||
{options.map(option => (
|
{options.map(option => (
|
||||||
<React.Fragment><input
|
<React.Fragment key={`${option.name}-${option.id}`} >
|
||||||
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
onChange={() => onSelect(option.value)}
|
onChange={() => onSelect(option.value)}
|
||||||
aria-label={option.ariaLabel}
|
aria-label={option.ariaLabel}
|
||||||
name={option.name}
|
name={option.name}
|
||||||
key={option.id}
|
key={`${option.name}-${option.id}-input`}
|
||||||
id={option.id}
|
id={option.id}
|
||||||
className="preference__radio-button"
|
className="preference__radio-button"
|
||||||
value={option.value}
|
value={option.value}
|
||||||
checked={value === option.value}
|
checked={value === option.value}
|
||||||
/><OptionLabel htmlFor={option.id} >{option.label}</OptionLabel>
|
/>
|
||||||
|
<OptionLabel
|
||||||
|
key={`${option.name}-${option.id}-label`}
|
||||||
|
htmlFor={option.id}
|
||||||
|
>
|
||||||
|
{option.label}
|
||||||
|
</OptionLabel>
|
||||||
</React.Fragment>))}
|
</React.Fragment>))}
|
||||||
</div>
|
</div>
|
||||||
</Preference>
|
</Preference>
|
||||||
);
|
);
|
||||||
|
|
||||||
Selector.defaultProps = {
|
PreferencePicker.defaultProps = {
|
||||||
options: []
|
options: []
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector.propTypes = {
|
PreferencePicker.propTypes = {
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]).isRequired,
|
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]).isRequired,
|
||||||
options: PropTypes.arrayOf(PropTypes.shape({
|
options: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
@ -57,4 +64,4 @@ Selector.propTypes = {
|
||||||
onSelect: PropTypes.func.isRequired,
|
onSelect: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Selector;
|
export default PreferencePicker;
|
||||||
|
|
Loading…
Reference in a new issue