👌 fixed warnings

This commit is contained in:
ghalestrilo 2020-07-01 17:36:25 -03:00
parent 3ce0a51c49
commit 82ec5207cb
2 changed files with 23 additions and 16 deletions

View File

@ -65,7 +65,7 @@ Header.propTypes = {
title: PropTypes.string,
subtitle: PropTypes.string,
leftButton: PropTypes.element,
children: PropTypes.arrayOf(PropTypes.element),
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]),
transparent: PropTypes.bool
};

View File

@ -18,34 +18,41 @@ const OptionLabel = styled.label.attrs({ className: 'preference__option' })`
font-size: ${remSize(14)} !important;
`;
const Selector = ({
const PreferencePicker = ({
title, value, onSelect, options,
}) => (
<Preference>
<PreferenceTitle>{title}</PreferenceTitle>
<div className="preference__options">
{options.map(option => (
<React.Fragment><input
type="radio"
onChange={() => onSelect(option.value)}
aria-label={option.ariaLabel}
name={option.name}
key={option.id}
id={option.id}
className="preference__radio-button"
value={option.value}
checked={value === option.value}
/><OptionLabel htmlFor={option.id} >{option.label}</OptionLabel>
<React.Fragment key={`${option.name}-${option.id}`} >
<input
type="radio"
onChange={() => onSelect(option.value)}
aria-label={option.ariaLabel}
name={option.name}
key={`${option.name}-${option.id}-input`}
id={option.id}
className="preference__radio-button"
value={option.value}
checked={value === option.value}
/>
<OptionLabel
key={`${option.name}-${option.id}-label`}
htmlFor={option.id}
>
{option.label}
</OptionLabel>
</React.Fragment>))}
</div>
</Preference>
);
Selector.defaultProps = {
PreferencePicker.defaultProps = {
options: []
};
Selector.propTypes = {
PreferencePicker.propTypes = {
title: PropTypes.string.isRequired,
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]).isRequired,
options: PropTypes.arrayOf(PropTypes.shape({
@ -57,4 +64,4 @@ Selector.propTypes = {
onSelect: PropTypes.func.isRequired,
};
export default Selector;
export default PreferencePicker;