Skip to content

Commit 37ba757

Browse files
authored
Merge pull request #14864 from TylerAPfledderer/refactor/pages-tutorial-remove-forwardRef
refactor(pages/tutorials): update forwardRef import for `FilterTag`
2 parents cf716db + fd4bfb6 commit 37ba757

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

src/pages/developers/tutorials.tsx

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import React, { HTMLAttributes, useEffect, useMemo, useState } from "react"
1+
import React, {
2+
type ButtonHTMLAttributes,
3+
forwardRef,
4+
HTMLAttributes,
5+
useEffect,
6+
useMemo,
7+
useState,
8+
} from "react"
29
import { GetStaticProps, InferGetServerSidePropsType } from "next"
310
import { useRouter } from "next/router"
411
import { useTranslation } from "next-i18next"
512
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
613
import { FaGithub } from "react-icons/fa"
7-
import { forwardRef } from "@chakra-ui/react"
814

915
import { BasePageProps, Lang } from "@/lib/types"
1016

@@ -45,22 +51,25 @@ type LinkFlexProps = FlexProps & {
4551
href: string
4652
}
4753

48-
const FilterTag = forwardRef<{ isActive: boolean; name: string }, "button">(
49-
(props, ref) => {
50-
const { isActive, name, ...rest } = props
51-
return (
52-
<TagButton
53-
ref={ref}
54-
variant={isActive ? "solid" : "outline"}
55-
status={isActive ? "tag" : "normal"}
56-
className="justify-center"
57-
{...rest}
58-
>
59-
{name}
60-
</TagButton>
61-
)
62-
}
63-
)
54+
const FilterTag = forwardRef<
55+
HTMLButtonElement,
56+
{ isActive: boolean; name: string } & ButtonHTMLAttributes<HTMLButtonElement>
57+
>((props, ref) => {
58+
const { isActive, name, ...rest } = props
59+
return (
60+
<TagButton
61+
ref={ref}
62+
variant={isActive ? "solid" : "outline"}
63+
status={isActive ? "tag" : "normal"}
64+
className="justify-center"
65+
{...rest}
66+
>
67+
{name}
68+
</TagButton>
69+
)
70+
})
71+
72+
FilterTag.displayName = "FilterTag"
6473

6574
const Text = ({ className, ...props }: HTMLAttributes<HTMLHeadElement>) => (
6675
<p className={cn("mb-6", className)} {...props} />

0 commit comments

Comments
 (0)