Commit 23fa4a23 authored by Mickaël Bourgier's avatar Mickaël Bourgier
Browse files

🔊 [ListItem] Add deprecation when `clickable` is falsy and `onClick` defined

parent a554a52b
## v1.3.0 (unreleased)
### Deprecations
- **[Collapse, Fade, Slide]** Using default value of the `appear` prop is
deprecated since it will change from `false` to `true` in v2.0 (!2 by @chapa)
- **[ListItem]** Using a falsy value for the `clickable` prop when `onClick` is
defined is deprecated since it will have no effect in v2.0 (!9 by @chapa)
### Bug fixes
- **[ListItem]** Prevent default event on click if component is "a"
- **[CssBaseline/colors]** Fix all colors were undefined
- **[CssBaseline/reboot]** Use primary color for links
### New features
- **[CssBaseline]** Add "cursor" feature (!7 by @chapa)
......
......@@ -105,9 +105,26 @@ ListItem.propTypes = {
className: PropTypes.string,
/**
* @deprecated
* Donne l'impression que l'élément est cliquable
*/
clickable: PropTypes.bool,
clickable: (props, propName, componentName, location, propFullName) => {
const componentNameSafe = componentName || '<<anonymous>>';
const propFullNameSafe = propFullName || propName;
if (!props[propName] && typeof props.onClick !== 'undefined') {
return new Error(
`A falsy value in \`${propFullNameSafe}\` ${location} of ` +
`\`${componentNameSafe}\` will be ignored in v2.0 when the ` +
`\`onClick\` prop is defined. Do not set a falsy value when ` +
`\`onClick\` is defined. See ` +
`https://git.webalternatif.com/webf/react-webf/issues/28 for more ` +
`infos.`
);
}
return null;
},
/**
* Couleur de l'élément, par défaut `'primary'` uniquement si la valeur de
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment