The Node.js® Website
1import { ArrowUpRightIcon } from '@heroicons/react/24/solid';
2import type { ComponentProps, FC, PropsWithChildren } from 'react';
3
4import Tabs from '@/components/Common/Tabs';
5import { Link } from '@/navigation.mjs';
6
7import styles from './index.module.css';
8
9type CodeTabsProps = Pick<
10 ComponentProps<typeof Tabs>,
11 'tabs' | 'defaultValue'
12> & {
13 linkUrl?: string;
14 linkText?: string;
15};
16
17const CodeTabs: FC<PropsWithChildren<CodeTabsProps>> = ({
18 children,
19 linkUrl,
20 linkText,
21 ...props
22}) => (
23 <Tabs
24 {...props}
25 className={styles.root}
26 addons={
27 linkUrl &&
28 linkText && (
29 <Link className={styles.link} href={linkUrl}>
30 {linkText}
31 <ArrowUpRightIcon className={styles.icon} />
32 </Link>
33 )
34 }
35 >
36 {children}
37 </Tabs>
38);
39
40export default CodeTabs;