Skip to content

Commit

Permalink
refactor: 잘못된 forwardRef 타입 수정 (#ATR-571)
Browse files Browse the repository at this point in the history
  • Loading branch information
LC-02s committed Jul 22, 2024
1 parent e4d80fb commit 21d9954
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions apps/service/src/features/filter-article/ui/FilterButton.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
'use client'

import React, {
DetailedHTMLProps,
InputHTMLAttributes,
LegacyRef,
type ButtonHTMLAttributes,
type DetailedHTMLProps,
forwardRef,
} from 'react'

const FilterButton = forwardRef<
HTMLInputElement,
HTMLButtonElement,
DetailedHTMLProps<
InputHTMLAttributes<HTMLButtonElement>,
ButtonHTMLAttributes<HTMLButtonElement>,
HTMLButtonElement
> & { active?: boolean }
>(({ type, className, active: isActive = false, onClick, ...props }, ref) => (
<button
ref={ref as LegacyRef<HTMLButtonElement> | undefined}
ref={ref}
type="button"
className={`flex h-10 items-center justify-center gap-2 rounded-lg px-3 py-2 transition-colors ${
isActive
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
'use client'

import React, {
DetailedHTMLProps,
InputHTMLAttributes,
LegacyRef,
type ButtonHTMLAttributes,
type DetailedHTMLProps,
forwardRef,
} from 'react'

const DefaultButton = forwardRef<
HTMLInputElement,
DetailedHTMLProps<InputHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
HTMLButtonElement,
DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
>(({ children, type, className, ...props }, ref) => (
<button
ref={ref as LegacyRef<HTMLButtonElement> | undefined}
ref={ref}
type="button"
className="block h-12 w-full rounded-lg bg-gray-700 p-2 text-center font-medium text-gray-50 transition-colors hover:bg-gray-800 disabled:!bg-gray-50 disabled:!text-gray-400 xs:text-lg md:h-10 md:rounded md:text-base dark:bg-gray-50 dark:text-gray-700 dark:hover:bg-gray-100 dark:disabled:!bg-gray-700 dark:disabled:!text-gray-500"
{...props}>
Expand Down

0 comments on commit 21d9954

Please sign in to comment.