File tree Expand file tree Collapse file tree 4 files changed +17
-33
lines changed
Releases/MinorReleasesTable Expand file tree Collapse file tree 4 files changed +17
-33
lines changed Original file line number Diff line number Diff line change 11import BaseButton from '@node-core/ui-components/Common/BaseButton' ;
22import type { ButtonProps } from '@node-core/ui-components/Common/BaseButton' ;
3- import type { FC , ComponentProps } from 'react' ;
3+ import type { FC } from 'react' ;
44
55import Link from '#site/components/Link' ;
66
7- const Button : FC <
8- Omit < ButtonProps , 'as' > & Omit < ComponentProps < typeof Link > , 'as' | 'size' >
9- > = props => < BaseButton as = { Link } { ...props } /> ;
7+ const Button : FC < ButtonProps > = props => < BaseButton as = { Link } { ...props } /> ;
108
119export default Button ;
Original file line number Diff line number Diff line change 1- import type { FC , HTMLProps } from 'react' ;
1+ import type { FC , AnchorHTMLAttributes , ComponentProps } from 'react' ;
22
33import { Link as LocalizedLink } from '#site/navigation.mjs' ;
44
5- const Link : FC < HTMLProps < HTMLAnchorElement > > = ( {
6- children,
7- href,
8- ...props
9- } ) => {
10- if ( ! href || / ^ h t t p s ? : / . test ( href . toString ( ) ) ) {
11- return (
12- < a href = { href } { ...props } >
13- { children }
14- </ a >
15- ) ;
5+ export type LinkProps =
6+ | ComponentProps < typeof LocalizedLink >
7+ | AnchorHTMLAttributes < HTMLAnchorElement > ;
8+
9+ const Link : FC < LinkProps > = ( { href, ...props } ) => {
10+ if ( ! href || / ^ h t t p s ? : / . test ( href as string ) ) {
11+ return < a href = { href as string } { ...props } /> ;
1612 }
1713
18- return (
19- < LocalizedLink href = { href ?. toString ( ) } { ...props } >
20- { children }
21- </ LocalizedLink >
22- ) ;
14+ return < LocalizedLink href = { href } { ...props } /> ;
2315} ;
2416
2517export default Link ;
Original file line number Diff line number Diff line change 11import { ArrowUpRightIcon } from '@heroicons/react/24/solid' ;
22import type { SlotProps } from '@radix-ui/react-slot' ;
33import { Slot } from '@radix-ui/react-slot' ;
4- import type { ComponentProps , FC , PropsWithChildren } from 'react' ;
4+ import type { FC , PropsWithChildren } from 'react' ;
55
66import Link from '#site/components/Link' ;
7+ import type { LinkProps } from '#site/components/Link' ;
78
89type LinkWithArrowProps =
9- | ( { asChild ?: false } & ComponentProps < typeof Link > )
10+ | ( { asChild ?: false } & LinkProps )
1011 | ( { asChild : true } & SlotProps ) ;
1112
1213const LinkWithArrow : FC < PropsWithChildren < LinkWithArrowProps > > = ( {
@@ -17,7 +18,7 @@ const LinkWithArrow: FC<PropsWithChildren<LinkWithArrowProps>> = ({
1718 const Comp = asChild ? Slot : Link ;
1819
1920 return (
20- < Comp { ...props } >
21+ < Comp { ...( props as SlotProps ) } >
2122 < span >
2223 { children }
2324 < ArrowUpRightIcon className = "ml-1 inline w-3 fill-neutral-600 dark:fill-white" />
Original file line number Diff line number Diff line change @@ -36,23 +36,16 @@ export const MinorReleasesTable: FC<MinorReleasesTableProps> = ({
3636 < td >
3737 < div className = { styles . links } >
3838 < Link
39- kind = "neutral"
4039 href = { `https://nodejs.org/download/release/v${ release . version } /` }
4140 >
4241 { t ( 'components.minorReleasesTable.actions.release' ) }
4342 </ Link >
4443 < Separator orientation = "vertical" />
45- < Link
46- kind = "neutral"
47- href = { `${ BASE_CHANGELOG_URL } ${ release . version } ` }
48- >
44+ < Link href = { `${ BASE_CHANGELOG_URL } ${ release . version } ` } >
4945 { t ( 'components.minorReleasesTable.actions.changelog' ) }
5046 </ Link >
5147 < Separator orientation = "vertical" />
52- < Link
53- kind = "neutral"
54- href = { getNodeApiUrl ( `v${ release . version } ` ) }
55- >
48+ < Link href = { getNodeApiUrl ( `v${ release . version } ` ) } >
5649 { t ( 'components.minorReleasesTable.actions.docs' ) }
5750 </ Link >
5851 </ div >
You can’t perform that action at this time.
0 commit comments