👌 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}`} >
|
||||||
type="radio"
|
<input
|
||||||
onChange={() => onSelect(option.value)}
|
type="radio"
|
||||||
aria-label={option.ariaLabel}
|
onChange={() => onSelect(option.value)}
|
||||||
name={option.name}
|
aria-label={option.ariaLabel}
|
||||||
key={option.id}
|
name={option.name}
|
||||||
id={option.id}
|
key={`${option.name}-${option.id}-input`}
|
||||||
className="preference__radio-button"
|
id={option.id}
|
||||||
value={option.value}
|
className="preference__radio-button"
|
||||||
checked={value === option.value}
|
value={option.value}
|
||||||
/><OptionLabel htmlFor={option.id} >{option.label}</OptionLabel>
|
checked={value === option.value}
|
||||||
|
/>
|
||||||
|
<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