Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move props destruction to component declaration #435

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/input/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import cn from 'classnames'
export type TextareaProps = ComponentPropsWithoutRef<'textarea'> & CommonProps

export const Textarea = forwardRef(
(props: TextareaProps, ref?: ForwardedRef<HTMLTextAreaElement>) => {
const {
(
{
id,
disabled = false,
label,
Expand All @@ -24,7 +24,9 @@ export const Textarea = forwardRef(
wrapperRef,
children,
...rest
} = props
}: TextareaProps,
ref?: ForwardedRef<HTMLTextAreaElement>,
) => {
const hasLabel = !!label && variant === 'default'

const hasError = !!error
Expand Down
8 changes: 5 additions & 3 deletions packages/modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export type ModalProps = Omit<ModalOverlayProps, 'title' | 'in'> & {
}

export const Modal = forwardRef(
(props: ModalProps, ref?: ForwardedRef<HTMLDivElement>) => {
const {
(
{
children,
title,
titleIcon,
Expand All @@ -27,7 +27,9 @@ export const Modal = forwardRef(
onClose,
onBack,
...rest
} = props
}: ModalProps,
ref?: ForwardedRef<HTMLDivElement>,
) => {
const withTitleIcon = !!titleIcon
const withSubtitle = !!subtitle
const withCloseButton = !!onClose
Expand Down
9 changes: 4 additions & 5 deletions packages/popup-menu/PopupMenuProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ export const usePopupMenuContext = (): PopupMenuContext => {
return useContext(Context)
}

export const PopupMenuProvider: FC<PropsWithChildren<PopupMenuContext>> = (
props,
) => {
const { variant, ...rest } = props

export const PopupMenuProvider: FC<PropsWithChildren<PopupMenuContext>> = ({
variant,
...rest
}) => {
return <Context.Provider value={{ variant }} {...rest} />
}
7 changes: 4 additions & 3 deletions packages/stack/StackProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ export const useStackContext = (): StackContext => {
return useContext(Context)
}

export const StackProvider: FC<PropsWithChildren<StackContext>> = (props) => {
const { spacing, ...rest } = props

export const StackProvider: FC<PropsWithChildren<StackContext>> = ({
spacing,
...rest
}) => {
return <Context.Provider value={{ spacing }} {...rest} />
}
9 changes: 5 additions & 4 deletions packages/transition/withTransition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default function withTransition<
): ForwardRefExoticComponent<
PropsWithoutRef<WrappedProps<P>> & RefAttributes<E>
> {
function Wrapped(props: WrappedProps<P>, externalRef: ForwardedRef<E>) {
const {
function Wrapped(
{
in: state = false,
timeout = DEFAULT_DURATION,
mountOnEnter = true,
Expand All @@ -39,8 +39,9 @@ export default function withTransition<
onExiting,
onExited,
...rest
} = props

}: WrappedProps<P>,
externalRef: ForwardedRef<E>,
) {
const transitionProps = {
in: state,
timeout,
Expand Down