diff --git a/core/app/[locale]/(default)/(faceted)/_components/refine-by.tsx b/core/app/[locale]/(default)/(faceted)/_components/refine-by.tsx index 9660ad0799..6dd14d0f01 100644 --- a/core/app/[locale]/(default)/(faceted)/_components/refine-by.tsx +++ b/core/app/[locale]/(default)/(faceted)/_components/refine-by.tsx @@ -4,7 +4,7 @@ import { usePathname, useRouter, useSearchParams } from 'next/navigation'; import { useTranslations } from 'next-intl'; import { useTransition } from 'react'; -import { Tag, TagAction, TagContent } from '~/components/ui/tag'; +import { Tag } from '~/components/ui/tag'; import type { Facet, PageType, PublicParamKeys } from '../types'; @@ -150,10 +150,10 @@ export const RefineBy = (props: Props) => { diff --git a/core/app/[locale]/(default)/blog/[blogId]/page.tsx b/core/app/[locale]/(default)/blog/[blogId]/page.tsx index aca532099f..7dd85b27c6 100644 --- a/core/app/[locale]/(default)/blog/[blogId]/page.tsx +++ b/core/app/[locale]/(default)/blog/[blogId]/page.tsx @@ -11,7 +11,7 @@ import { BlogPostImage, BlogPostTitle, } from '~/components/ui/blog-post-card'; -import { Tag, TagContent } from '~/components/ui/tag'; +import { Tag } from '~/components/ui/tag'; import { LocaleType } from '~/i18n'; import { SharingLinks } from './_components/sharing-links'; @@ -83,9 +83,7 @@ export default async function BlogPostPage({ params: { blogId, locale } }: Props
{blogPost.tags.map((tag) => ( - - {tag} - + ))}
diff --git a/core/components/ui/tag/tag.tsx b/core/components/ui/tag/tag.tsx index 842844c8e3..38d4789e8f 100644 --- a/core/components/ui/tag/tag.tsx +++ b/core/components/ui/tag/tag.tsx @@ -1,57 +1,34 @@ import { X } from 'lucide-react'; -import { ComponentPropsWithRef, ElementRef, forwardRef } from 'react'; +import { ComponentPropsWithoutRef } from 'react'; import { cn } from '~/lib/utils'; -type TagProps = ComponentPropsWithRef<'div'>; +interface Props extends ComponentPropsWithoutRef<'div'> { + tagContent: string; + tagAction?: () => void; +} -const Tag = forwardRef, TagProps>(({ className, ...props }, ref) => { +const Tag = ({ className, tagContent, tagAction, ...props }: Props) => { return (
+ > + {tagContent} + {tagAction && ( + + )} +
); -}); - -Tag.displayName = 'Tag'; - -type TagContentProps = ComponentPropsWithRef<'span'>; - -const TagContent = forwardRef, TagContentProps>( - ({ className, ...props }, ref) => { - return ( - - ); - }, -); - -TagContent.displayName = 'TagContent'; - -type TagActionProps = ComponentPropsWithRef<'button'>; - -const TagAction = forwardRef, TagActionProps>( - ({ className, children, ...props }, ref) => { - return ( - - ); - }, -); - -TagAction.displayName = 'TagAction'; +}; -export { Tag, TagContent, TagAction }; -export type { TagProps, TagContentProps, TagActionProps }; +export { Tag };