From 7a3e82fbaade16d103a62556963c2effc638ba95 Mon Sep 17 00:00:00 2001 From: karinamaulitova Date: Tue, 1 Aug 2023 17:51:00 +0200 Subject: [PATCH] fix: move props destruction to component declaration --- packages/input/Textarea.tsx | 8 +++++--- packages/modal/Modal.tsx | 8 +++++--- packages/popup-menu/PopupMenuProvider.tsx | 9 ++++----- packages/stack/StackProvider.tsx | 7 ++++--- packages/transition/withTransition.tsx | 9 +++++---- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/packages/input/Textarea.tsx b/packages/input/Textarea.tsx index c9032d69..0d23cfb1 100644 --- a/packages/input/Textarea.tsx +++ b/packages/input/Textarea.tsx @@ -6,8 +6,8 @@ import cn from 'classnames' export type TextareaProps = ComponentPropsWithoutRef<'textarea'> & CommonProps export const Textarea = forwardRef( - (props: TextareaProps, ref?: ForwardedRef) => { - const { + ( + { id, disabled = false, label, @@ -24,7 +24,9 @@ export const Textarea = forwardRef( wrapperRef, children, ...rest - } = props + }: TextareaProps, + ref?: ForwardedRef, + ) => { const hasLabel = !!label && variant === 'default' const hasError = !!error diff --git a/packages/modal/Modal.tsx b/packages/modal/Modal.tsx index 4d5a914d..d9b062de 100644 --- a/packages/modal/Modal.tsx +++ b/packages/modal/Modal.tsx @@ -15,8 +15,8 @@ export type ModalProps = Omit & { } export const Modal = forwardRef( - (props: ModalProps, ref?: ForwardedRef) => { - const { + ( + { children, title, titleIcon, @@ -27,7 +27,9 @@ export const Modal = forwardRef( onClose, onBack, ...rest - } = props + }: ModalProps, + ref?: ForwardedRef, + ) => { const withTitleIcon = !!titleIcon const withSubtitle = !!subtitle const withCloseButton = !!onClose diff --git a/packages/popup-menu/PopupMenuProvider.tsx b/packages/popup-menu/PopupMenuProvider.tsx index d66459f3..ef296cf1 100644 --- a/packages/popup-menu/PopupMenuProvider.tsx +++ b/packages/popup-menu/PopupMenuProvider.tsx @@ -11,10 +11,9 @@ export const usePopupMenuContext = (): PopupMenuContext => { return useContext(Context) } -export const PopupMenuProvider: FC> = ( - props, -) => { - const { variant, ...rest } = props - +export const PopupMenuProvider: FC> = ({ + variant, + ...rest +}) => { return } diff --git a/packages/stack/StackProvider.tsx b/packages/stack/StackProvider.tsx index d5cba5a1..d85d2b88 100644 --- a/packages/stack/StackProvider.tsx +++ b/packages/stack/StackProvider.tsx @@ -11,8 +11,9 @@ export const useStackContext = (): StackContext => { return useContext(Context) } -export const StackProvider: FC> = (props) => { - const { spacing, ...rest } = props - +export const StackProvider: FC> = ({ + spacing, + ...rest +}) => { return } diff --git a/packages/transition/withTransition.tsx b/packages/transition/withTransition.tsx index 78fdfd93..00dfd998 100644 --- a/packages/transition/withTransition.tsx +++ b/packages/transition/withTransition.tsx @@ -22,8 +22,8 @@ export default function withTransition< ): ForwardRefExoticComponent< PropsWithoutRef> & RefAttributes > { - function Wrapped(props: WrappedProps

, externalRef: ForwardedRef) { - const { + function Wrapped( + { in: state = false, timeout = DEFAULT_DURATION, mountOnEnter = true, @@ -39,8 +39,9 @@ export default function withTransition< onExiting, onExited, ...rest - } = props - + }: WrappedProps

, + externalRef: ForwardedRef, + ) { const transitionProps = { in: state, timeout,