File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use client' ;
22
3- import { ArrowUpRightIcon } from '@heroicons/react/24/solid' ;
43import { useTranslations } from 'next-intl' ;
54import type { FC } from 'react' ;
65import { use } from 'react' ;
76
7+ import LinkWithArrow from '#site/components/LinkWithArrow' ;
88import { ReleaseModalContext } from '#site/providers/releaseModalProvider' ;
99import type { NodeRelease } from '#site/types' ;
1010
@@ -18,15 +18,13 @@ const DetailsButton: FC<DetailsButtonProps> = ({ versionData }) => {
1818 const { openModal } = use ( ReleaseModalContext ) ;
1919
2020 return (
21- < button
22- type = "button"
23- className = "cursor-pointer text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-200"
21+ < LinkWithArrow
2422 onClick = { ( ) => openModal ( versionData ) }
2523 aria-label = { t ( 'details' ) }
24+ className = "cursor-pointer"
2625 >
2726 { t ( 'details' ) }
28- < ArrowUpRightIcon className = "ml-1 inline w-3 fill-neutral-600 dark:fill-white" />
29- </ button >
27+ </ LinkWithArrow >
3028 ) ;
3129} ;
3230
Original file line number Diff line number Diff line change 33import type { FC , PropsWithChildren } from 'react' ;
44import { useContext } from 'react' ;
55
6- import Link from '#site/components/Link' ;
76import LinkWithArrow from '#site/components/LinkWithArrow' ;
87import { BASE_CHANGELOG_URL } from '#site/next.constants.mjs' ;
98import { ReleaseContext } from '#site/providers/releaseProvider' ;
@@ -12,8 +11,8 @@ const ChangelogLink: FC<PropsWithChildren> = ({ children }) => {
1211 const { release } = useContext ( ReleaseContext ) ;
1312
1413 return (
15- < LinkWithArrow asChild >
16- < Link href = { ` ${ BASE_CHANGELOG_URL } ${ release . version } ` } > { children } </ Link >
14+ < LinkWithArrow href = { ` ${ BASE_CHANGELOG_URL } ${ release . version } ` } >
15+ { children }
1716 </ LinkWithArrow >
1817 ) ;
1918} ;
Original file line number Diff line number Diff line change 11import { ArrowUpRightIcon } from '@heroicons/react/24/solid' ;
2- import type { SlotProps } from '@radix-ui/react-slot' ;
3- import { Slot } from '@radix-ui/react-slot' ;
4- import type { ComponentProps , FC , PropsWithChildren } from 'react' ;
2+ import type {
3+ AnchorHTMLAttributes ,
4+ ButtonHTMLAttributes ,
5+ FC ,
6+ PropsWithChildren ,
7+ } from 'react' ;
58
69import Link from '#site/components/Link' ;
710
811type LinkWithArrowProps =
9- | ( { asChild ?: false } & ComponentProps < typeof Link > )
10- | ( { asChild : true } & SlotProps ) ;
12+ | ( { href : string } & AnchorHTMLAttributes < HTMLAnchorElement > )
13+ | ( Omit < ButtonHTMLAttributes < HTMLButtonElement > , 'type' > & { href ?: never } ) ;
1114
12- const LinkWithArrow : FC < PropsWithChildren < LinkWithArrowProps > > = ( {
13- children,
14- asChild = false ,
15- ...props
16- } ) => {
17- const Comp = asChild ? Slot : Link ;
15+ const LinkWithArrow : FC < PropsWithChildren < LinkWithArrowProps > > = props => {
16+ const { children, className, ...rest } = props ;
17+
18+ if ( 'href' in props && props . href ) {
19+ return (
20+ < Link
21+ { ...( rest as AnchorHTMLAttributes < HTMLAnchorElement > ) }
22+ className = { className }
23+ >
24+ < span >
25+ { children }
26+ < ArrowUpRightIcon className = "ml-1 inline w-3 fill-neutral-600 dark:fill-white" />
27+ </ span >
28+ </ Link >
29+ ) ;
30+ }
1831
1932 return (
20- < Comp { ...props } >
33+ < button
34+ type = "button"
35+ { ...( rest as ButtonHTMLAttributes < HTMLButtonElement > ) }
36+ className = { `${ className || '' } text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-200` }
37+ >
2138 < span >
2239 { children }
2340 < ArrowUpRightIcon className = "ml-1 inline w-3 fill-neutral-600 dark:fill-white" />
2441 </ span >
25- </ Comp >
42+ </ button >
2643 ) ;
2744} ;
2845
You can’t perform that action at this time.
0 commit comments