From 622be1d500146d641610964020210b8582f049cc Mon Sep 17 00:00:00 2001 From: veeck Date: Mon, 19 Aug 2024 13:15:32 +0200 Subject: [PATCH] remove defaultProps from functional components --- packages/components/src/base_tooltip/index.jsx | 6 +----- packages/components/src/cookies_form/index.jsx | 12 +++--------- packages/components/src/feature_alert/index.jsx | 12 +++--------- .../components/src/feature_alert_label/index.jsx | 11 ++++++----- packages/components/src/logo/index.jsx | 7 +------ .../components/src/network_form/network_form.jsx | 6 +----- packages/components/src/progress_line/index.jsx | 12 +++--------- 7 files changed, 18 insertions(+), 48 deletions(-) diff --git a/packages/components/src/base_tooltip/index.jsx b/packages/components/src/base_tooltip/index.jsx index b6cf8d3f..596de640 100644 --- a/packages/components/src/base_tooltip/index.jsx +++ b/packages/components/src/base_tooltip/index.jsx @@ -7,7 +7,7 @@ import styles from './index.module.scss'; const BaseTooltip = (props) => { const { - position, + position = 'top', bubble, children, tooltipClassName, @@ -57,10 +57,6 @@ const BaseTooltip = (props) => { ); }; -BaseTooltip.defaultProps = { - position: 'top', -}; - BaseTooltip.propTypes = { active: PropTypes.bool, position: PropTypes.string.isRequired, diff --git a/packages/components/src/cookies_form/index.jsx b/packages/components/src/cookies_form/index.jsx index f5e6994e..f4fbd586 100644 --- a/packages/components/src/cookies_form/index.jsx +++ b/packages/components/src/cookies_form/index.jsx @@ -13,9 +13,9 @@ const CookiesDetails = ({ text }) => ( const CookiesForm = ({ className, - compactView, - defaultModel, - translations, + compactView = false, + defaultModel = {}, + translations = {}, onSubmit, ...rest }) => { @@ -71,12 +71,6 @@ const CookiesForm = ({ ); }; -CookiesForm.defaultProps = { - compactView: false, - defaultModel: {}, - translations: {}, -}; - CookiesForm.propTypes = { className: PropTypes.string, compactView: PropTypes.bool.isRequired, diff --git a/packages/components/src/feature_alert/index.jsx b/packages/components/src/feature_alert/index.jsx index f05f94b6..42e283d3 100644 --- a/packages/components/src/feature_alert/index.jsx +++ b/packages/components/src/feature_alert/index.jsx @@ -24,12 +24,12 @@ import styles from './index.module.scss'; const FeatureAlertTooltip = (props) => { const { - position, + position = TOOLTIP_POSITION_LEFT, trigger, content, children, - closeIcon, - defaultOpen, + closeIcon = false, + defaultOpen = false, onOpen, onClose, className, @@ -84,12 +84,6 @@ const FeatureAlertTooltip = (props) => { ); }; -FeatureAlertTooltip.defaultProps = { - position: TOOLTIP_POSITION_LEFT, - closeIcon: false, - defaultOpen: false, -}; - FeatureAlertTooltip.propTypes = { className: PropTypes.string, position: PropTypes.oneOf([ diff --git a/packages/components/src/feature_alert_label/index.jsx b/packages/components/src/feature_alert_label/index.jsx index 1afbd5ad..83e02ce8 100644 --- a/packages/components/src/feature_alert_label/index.jsx +++ b/packages/components/src/feature_alert_label/index.jsx @@ -9,7 +9,12 @@ import { import styles from './index.module.scss'; -const FeatureAlertLabel = ({ position, label, children, className, ...cleanProps }) => { +const FeatureAlertLabel = ({ + position = TOOLTIP_POSITION_RIGHT, + label, + children, + className, + ...cleanProps }) => { const labelClassName = clsx(styles.label, styles[`is-position-${position}`], className); return (