@node-core/ui-components 0.0.1 → 1.0.1-31c31c9e3d61d76150eae83e7d2385b86cfdef71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/AlertBox/index.module.css +76 -0
- package/Common/AlertBox/index.stories.tsx +73 -0
- package/Common/AlertBox/index.tsx +24 -0
- package/Common/AvatarGroup/Avatar/index.module.css +40 -0
- package/Common/AvatarGroup/Avatar/index.stories.tsx +22 -0
- package/Common/AvatarGroup/Avatar/index.tsx +67 -0
- package/Common/AvatarGroup/Overlay/index.module.css +31 -0
- package/Common/AvatarGroup/Overlay/index.stories.tsx +33 -0
- package/Common/AvatarGroup/Overlay/index.tsx +37 -0
- package/Common/AvatarGroup/__tests__/index.test.jsx +55 -0
- package/Common/AvatarGroup/index.module.css +25 -0
- package/Common/AvatarGroup/index.stories.tsx +56 -0
- package/Common/AvatarGroup/index.tsx +87 -0
- package/Common/Badge/index.module.css +38 -0
- package/Common/Badge/index.stories.tsx +38 -0
- package/Common/Badge/index.tsx +35 -0
- package/Common/BadgeGroup/index.module.css +77 -0
- package/Common/BadgeGroup/index.stories.tsx +35 -0
- package/Common/BadgeGroup/index.tsx +35 -0
- package/Common/Banner/index.module.css +42 -0
- package/Common/Banner/index.stories.tsx +29 -0
- package/Common/Banner/index.tsx +18 -0
- package/Common/BaseActiveLink/__tests__/index.test.jsx +52 -0
- package/Common/BaseActiveLink/index.tsx +34 -0
- package/Common/BaseButton/index.module.css +142 -0
- package/Common/BaseButton/index.stories.tsx +67 -0
- package/Common/BaseButton/index.tsx +59 -0
- package/Common/BaseCodeBox/index.module.css +78 -0
- package/Common/BaseCodeBox/index.stories.tsx +39 -0
- package/Common/BaseCodeBox/index.tsx +122 -0
- package/Common/BaseCrossLink/index.module.css +51 -0
- package/Common/BaseCrossLink/index.stories.tsx +38 -0
- package/Common/BaseCrossLink/index.tsx +46 -0
- package/Common/BaseLinkTabs/index.module.css +43 -0
- package/Common/BaseLinkTabs/index.stories.tsx +34 -0
- package/Common/BaseLinkTabs/index.tsx +53 -0
- package/Common/BasePagination/Ellipsis/index.module.css +10 -0
- package/Common/BasePagination/Ellipsis/index.stories.tsx +10 -0
- package/Common/BasePagination/Ellipsis/index.tsx +11 -0
- package/Common/BasePagination/PaginationListItem/__tests__/index.test.jsx +58 -0
- package/Common/BasePagination/PaginationListItem/index.module.css +27 -0
- package/Common/BasePagination/PaginationListItem/index.stories.tsx +40 -0
- package/Common/BasePagination/PaginationListItem/index.tsx +39 -0
- package/Common/BasePagination/PrevNextArrow.tsx +15 -0
- package/Common/BasePagination/__tests__/index.test.jsx +180 -0
- package/Common/BasePagination/index.module.css +39 -0
- package/Common/BasePagination/index.stories.tsx +67 -0
- package/Common/BasePagination/index.tsx +77 -0
- package/Common/BasePagination/useGetPageElements.tsx +132 -0
- package/Common/Blockquote/index.module.css +29 -0
- package/Common/Blockquote/index.stories.tsx +45 -0
- package/Common/Blockquote/index.tsx +11 -0
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.module.css +5 -0
- package/Common/Breadcrumbs/BreadcrumbHomeLink/index.tsx +30 -0
- package/Common/Breadcrumbs/BreadcrumbItem/index.module.css +41 -0
- package/Common/Breadcrumbs/BreadcrumbItem/index.tsx +42 -0
- package/Common/Breadcrumbs/BreadcrumbLink/index.module.css +22 -0
- package/Common/Breadcrumbs/BreadcrumbLink/index.tsx +37 -0
- package/Common/Breadcrumbs/BreadcrumbRoot/index.module.css +9 -0
- package/Common/Breadcrumbs/BreadcrumbRoot/index.tsx +20 -0
- package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.tsx +9 -0
- package/Common/Breadcrumbs/index.stories.tsx +94 -0
- package/Common/Breadcrumbs/index.tsx +81 -0
- package/Common/CodeTabs/index.module.css +56 -0
- package/Common/CodeTabs/index.stories.tsx +73 -0
- package/Common/CodeTabs/index.tsx +16 -0
- package/Common/DataTag/index.module.css +56 -0
- package/Common/DataTag/index.stories.tsx +40 -0
- package/Common/DataTag/index.tsx +39 -0
- package/Common/GlowingBackdrop/index.module.css +32 -0
- package/Common/GlowingBackdrop/index.stories.tsx +10 -0
- package/Common/GlowingBackdrop/index.tsx +13 -0
- package/Common/LanguageDropDown/index.module.css +53 -0
- package/Common/LanguageDropDown/index.stories.tsx +19 -0
- package/Common/LanguageDropDown/index.tsx +56 -0
- package/Common/Modal/index.module.css +79 -0
- package/Common/Modal/index.stories.tsx +32 -0
- package/Common/Modal/index.tsx +48 -0
- package/Common/NodejsLogo/index.module.css +6 -0
- package/Common/NodejsLogo/index.stories.tsx +14 -0
- package/Common/NodejsLogo/index.tsx +26 -0
- package/Common/Notification/index.module.css +20 -0
- package/Common/Notification/index.stories.tsx +36 -0
- package/Common/Notification/index.tsx +34 -0
- package/Common/Preview/index.module.css +79 -0
- package/Common/Preview/index.stories.tsx +44 -0
- package/Common/Preview/index.tsx +25 -0
- package/Common/ProgressionSidebar/ProgressionSidebarGroup/index.module.css +47 -0
- package/Common/ProgressionSidebar/ProgressionSidebarGroup/index.tsx +35 -0
- package/Common/ProgressionSidebar/ProgressionSidebarIcon/index.tsx +16 -0
- package/Common/ProgressionSidebar/ProgressionSidebarItem/index.module.css +39 -0
- package/Common/ProgressionSidebar/ProgressionSidebarItem/index.tsx +32 -0
- package/Common/ProgressionSidebar/index.module.css +30 -0
- package/Common/ProgressionSidebar/index.stories.tsx +79 -0
- package/Common/ProgressionSidebar/index.tsx +59 -0
- package/Common/Select/__tests__/index.test.jsx +67 -0
- package/Common/Select/index.module.css +161 -0
- package/Common/Select/index.stories.tsx +111 -0
- package/Common/Select/index.tsx +187 -0
- package/Common/Separator/index.module.css +16 -0
- package/Common/Separator/index.stories.tsx +32 -0
- package/Common/Separator/index.tsx +27 -0
- package/Common/Skeleton/index.module.css +30 -0
- package/Common/Skeleton/index.tsx +39 -0
- package/Common/Tabs/__tests__/index.test.jsx +52 -0
- package/Common/Tabs/index.module.css +54 -0
- package/Common/Tabs/index.stories.tsx +50 -0
- package/Common/Tabs/index.tsx +54 -0
- package/Common/ThemeToggle/__tests__/index.test.jsx +35 -0
- package/Common/ThemeToggle/index.module.css +15 -0
- package/Common/ThemeToggle/index.stories.tsx +10 -0
- package/Common/ThemeToggle/index.tsx +15 -0
- package/Common/Tooltip/index.module.css +43 -0
- package/Common/Tooltip/index.stories.tsx +73 -0
- package/Common/Tooltip/index.tsx +48 -0
- package/Containers/Article/index.module.css +70 -0
- package/Containers/Article/index.stories.tsx +39 -0
- package/Containers/Article/index.tsx +9 -0
- package/Containers/Footer/index.module.css +46 -0
- package/Containers/Footer/index.stories.tsx +27 -0
- package/Containers/Footer/index.tsx +95 -0
- package/Containers/MetaBar/__tests__/index.test.jsx +63 -0
- package/Containers/MetaBar/index.module.css +91 -0
- package/Containers/MetaBar/index.stories.tsx +80 -0
- package/Containers/MetaBar/index.tsx +72 -0
- package/Containers/NavBar/NavItem/index.module.css +60 -0
- package/Containers/NavBar/NavItem/index.stories.tsx +38 -0
- package/Containers/NavBar/NavItem/index.tsx +44 -0
- package/Containers/NavBar/index.module.css +125 -0
- package/Containers/NavBar/index.stories.tsx +45 -0
- package/Containers/NavBar/index.tsx +94 -0
- package/Containers/Sidebar/SidebarGroup/index.module.css +26 -0
- package/Containers/Sidebar/SidebarGroup/index.stories.tsx +36 -0
- package/Containers/Sidebar/SidebarGroup/index.tsx +30 -0
- package/Containers/Sidebar/SidebarItem/index.module.css +35 -0
- package/Containers/Sidebar/SidebarItem/index.stories.tsx +15 -0
- package/Containers/Sidebar/SidebarItem/index.tsx +26 -0
- package/Containers/Sidebar/index.module.css +31 -0
- package/Containers/Sidebar/index.stories.tsx +84 -0
- package/Containers/Sidebar/index.tsx +58 -0
- package/Icons/HexagonGrid.stories.tsx +10 -0
- package/Icons/HexagonGrid.tsx +1434 -0
- package/Icons/InstallationMethod/Choco.tsx +78 -0
- package/Icons/InstallationMethod/Devbox.tsx +21 -0
- package/Icons/InstallationMethod/Docker.tsx +20 -0
- package/Icons/InstallationMethod/FNM.tsx +132 -0
- package/Icons/InstallationMethod/Homebrew.tsx +69 -0
- package/Icons/InstallationMethod/N.tsx +32 -0
- package/Icons/InstallationMethod/NVM.tsx +63 -0
- package/Icons/InstallationMethod/Volta.tsx +34 -0
- package/Icons/InstallationMethod/index.ts +10 -0
- package/Icons/Logos/JsGreen.tsx +24 -0
- package/Icons/Logos/JsWhite.tsx +37 -0
- package/Icons/Logos/Nodejs.tsx +188 -0
- package/Icons/Logos/NodejsStackedBlack.tsx +98 -0
- package/Icons/Logos/NodejsStackedDark.tsx +124 -0
- package/Icons/Logos/NodejsStackedLight.tsx +123 -0
- package/Icons/Logos/NodejsStackedWhite.tsx +98 -0
- package/Icons/Logos/index.ts +17 -0
- package/Icons/OperatingSystem/AIX.tsx +46 -0
- package/Icons/OperatingSystem/Apple.tsx +23 -0
- package/Icons/OperatingSystem/Linux.tsx +969 -0
- package/Icons/OperatingSystem/Microsoft.tsx +19 -0
- package/Icons/OperatingSystem/index.ts +6 -0
- package/Icons/PackageManager/Npm.tsx +21 -0
- package/Icons/PackageManager/Pnpm.tsx +22 -0
- package/Icons/PackageManager/Yarn.tsx +22 -0
- package/Icons/PackageManager/index.ts +5 -0
- package/Icons/Social/Bluesky.tsx +19 -0
- package/Icons/Social/Discord.tsx +20 -0
- package/Icons/Social/GitHub.tsx +16 -0
- package/Icons/Social/LinkedIn.tsx +16 -0
- package/Icons/Social/Mastodon.tsx +36 -0
- package/Icons/Social/Slack.tsx +31 -0
- package/Icons/Social/X.tsx +16 -0
- package/Icons/Social/index.ts +9 -0
- package/LICENSE +21 -0
- package/MDX/CodeTabs.tsx +47 -0
- package/package.json +87 -5
- package/stylelint/__tests__/index.test.mjs +80 -0
- package/stylelint/one-utility-class-per-line.mjs +64 -0
- package/stylelint/utils.mjs +53 -0
- package/styles/animations.css +47 -0
- package/styles/base.css +17 -0
- package/styles/effects.css +12 -0
- package/styles/index.css +38 -0
- package/styles/markdown.css +173 -0
- package/styles/theme.css +175 -0
- package/types.ts +25 -0
- package/README.md +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@reference "../../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.item {
|
|
4
|
+
@apply flex
|
|
5
|
+
max-w-fit
|
|
6
|
+
items-center
|
|
7
|
+
gap-5
|
|
8
|
+
truncate
|
|
9
|
+
text-sm
|
|
10
|
+
font-medium;
|
|
11
|
+
|
|
12
|
+
&:last-child {
|
|
13
|
+
@apply w-full;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
@apply shrink
|
|
18
|
+
grow;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&,
|
|
22
|
+
> a,
|
|
23
|
+
> a:hover {
|
|
24
|
+
@apply text-neutral-800
|
|
25
|
+
motion-safe:transition-colors
|
|
26
|
+
dark:text-neutral-200;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.visuallyHidden {
|
|
30
|
+
@apply hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.separator {
|
|
34
|
+
@apply size-4
|
|
35
|
+
max-w-fit
|
|
36
|
+
shrink-0
|
|
37
|
+
grow
|
|
38
|
+
text-neutral-600
|
|
39
|
+
dark:text-neutral-400;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import type { ComponentProps, FC, PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
import styles from './index.module.css';
|
|
6
|
+
|
|
7
|
+
type BreadcrumbItemProps = {
|
|
8
|
+
disableMicrodata?: boolean;
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
hideSeparator?: boolean;
|
|
11
|
+
position?: number;
|
|
12
|
+
} & ComponentProps<'li'>;
|
|
13
|
+
|
|
14
|
+
const BreadcrumbItem: FC<PropsWithChildren<BreadcrumbItemProps>> = ({
|
|
15
|
+
disableMicrodata,
|
|
16
|
+
children,
|
|
17
|
+
hidden = false,
|
|
18
|
+
hideSeparator = false,
|
|
19
|
+
position,
|
|
20
|
+
...props
|
|
21
|
+
}) => (
|
|
22
|
+
<li
|
|
23
|
+
{...props}
|
|
24
|
+
itemProp={!disableMicrodata ? 'itemListElement' : undefined}
|
|
25
|
+
itemScope={!disableMicrodata ? true : undefined}
|
|
26
|
+
itemType={!disableMicrodata ? 'https://schema.org/ListItem' : undefined}
|
|
27
|
+
className={classNames(
|
|
28
|
+
styles.item,
|
|
29
|
+
{ [styles.visuallyHidden]: hidden },
|
|
30
|
+
props.className
|
|
31
|
+
)}
|
|
32
|
+
aria-hidden={hidden ? 'true' : undefined}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
{position && <meta itemProp="position" content={`${position}`} />}
|
|
36
|
+
{!hideSeparator && (
|
|
37
|
+
<ChevronRightIcon aria-hidden="true" className={styles.separator} />
|
|
38
|
+
)}
|
|
39
|
+
</li>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export default BreadcrumbItem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@reference "../../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.link {
|
|
4
|
+
@apply max-w-fit
|
|
5
|
+
truncate;
|
|
6
|
+
|
|
7
|
+
&.active {
|
|
8
|
+
@apply rounded
|
|
9
|
+
bg-green-600
|
|
10
|
+
px-2
|
|
11
|
+
py-1
|
|
12
|
+
font-semibold
|
|
13
|
+
text-white
|
|
14
|
+
motion-safe:transition-colors
|
|
15
|
+
dark:text-white;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
@apply bg-green-700
|
|
19
|
+
text-white;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import type { ComponentProps, FC } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { LinkLike } from '#ui/types';
|
|
5
|
+
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
|
|
8
|
+
type BreadcrumbLinkProps = {
|
|
9
|
+
active?: boolean;
|
|
10
|
+
as: LinkLike;
|
|
11
|
+
} & ComponentProps<LinkLike>;
|
|
12
|
+
|
|
13
|
+
const BreadcrumbLink: FC<BreadcrumbLinkProps> = ({
|
|
14
|
+
href,
|
|
15
|
+
active,
|
|
16
|
+
as: Component = 'a',
|
|
17
|
+
...props
|
|
18
|
+
}) => (
|
|
19
|
+
<Component
|
|
20
|
+
itemScope
|
|
21
|
+
itemType="http://schema.org/Thing"
|
|
22
|
+
itemProp="item"
|
|
23
|
+
itemID={href?.toString()}
|
|
24
|
+
href={href}
|
|
25
|
+
className={classNames(
|
|
26
|
+
styles.link,
|
|
27
|
+
{ [styles.active]: active },
|
|
28
|
+
props.className
|
|
29
|
+
)}
|
|
30
|
+
aria-current={active ? 'page' : undefined}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
<span itemProp="name">{props.children}</span>
|
|
34
|
+
</Component>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export default BreadcrumbLink;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren, ComponentProps } from 'react';
|
|
2
|
+
|
|
3
|
+
import styles from './index.module.css';
|
|
4
|
+
|
|
5
|
+
const BreadcrumbRoot: FC<PropsWithChildren<ComponentProps<'nav'>>> = ({
|
|
6
|
+
children,
|
|
7
|
+
...props
|
|
8
|
+
}) => (
|
|
9
|
+
<nav aria-label="breadcrumb" {...props}>
|
|
10
|
+
<ol
|
|
11
|
+
itemScope
|
|
12
|
+
itemType="https://schema.org/BreadcrumbList"
|
|
13
|
+
className={styles.list}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
16
|
+
</ol>
|
|
17
|
+
</nav>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export default BreadcrumbRoot;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import Breadcrumbs from '#ui/Common/Breadcrumbs';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof Breadcrumbs>;
|
|
6
|
+
type Meta = MetaObj<typeof Breadcrumbs>;
|
|
7
|
+
|
|
8
|
+
export const Default: Story = {
|
|
9
|
+
args: {
|
|
10
|
+
links: [
|
|
11
|
+
{
|
|
12
|
+
label: 'Learn',
|
|
13
|
+
href: '/learn',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: 'Getting Started',
|
|
17
|
+
href: '/learn/getting-started',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 'Introduction to Node.js',
|
|
21
|
+
href: '/learn/getting-started/intro',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Linkless: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
links: [
|
|
30
|
+
{
|
|
31
|
+
label: 'Learn',
|
|
32
|
+
href: '',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: 'Getting Started',
|
|
36
|
+
href: '',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Introduction to Node.js',
|
|
40
|
+
href: '',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Truncate: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
links: [
|
|
49
|
+
{
|
|
50
|
+
label: 'Learn',
|
|
51
|
+
href: '/learn',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'Getting Started',
|
|
55
|
+
href: '/learn/getting-started',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: 'Introduction to Node.js',
|
|
59
|
+
href: '/learn/getting-started/intro',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: 'Installation',
|
|
63
|
+
href: '/learn/getting-started/intro/installation',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: 'Documentation',
|
|
67
|
+
href: '/learn/getting-started/intro/installation/documentation',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
maxLength: 1,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const HiddenHome: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
hideHome: true,
|
|
77
|
+
links: [
|
|
78
|
+
{
|
|
79
|
+
label: 'Learn',
|
|
80
|
+
href: '/learn',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: 'Getting Started',
|
|
84
|
+
href: '/learn/getting-started',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: 'Introduction to Node.js',
|
|
88
|
+
href: '/learn/getting-started/intro',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default { component: Breadcrumbs } as Meta;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
import BreadcrumbHomeLink from '#ui/Common/Breadcrumbs/BreadcrumbHomeLink';
|
|
5
|
+
import BreadcrumbItem from '#ui/Common/Breadcrumbs/BreadcrumbItem';
|
|
6
|
+
import BreadcrumbLink from '#ui/Common/Breadcrumbs/BreadcrumbLink';
|
|
7
|
+
import BreadcrumbRoot from '#ui/Common/Breadcrumbs/BreadcrumbRoot';
|
|
8
|
+
import BreadcrumbTruncatedItem from '#ui/Common/Breadcrumbs/BreadcrumbTruncatedItem';
|
|
9
|
+
import type { FormattedMessage, LinkLike } from '#ui/types';
|
|
10
|
+
|
|
11
|
+
export type BreadcrumbLink = {
|
|
12
|
+
label: FormattedMessage;
|
|
13
|
+
href: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type BreadcrumbsProps = {
|
|
17
|
+
links: Array<BreadcrumbLink>;
|
|
18
|
+
maxLength?: number;
|
|
19
|
+
hideHome?: boolean;
|
|
20
|
+
as: LinkLike;
|
|
21
|
+
homeLinkAriaLabel?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const Breadcrumbs: FC<BreadcrumbsProps> = ({
|
|
25
|
+
links = [],
|
|
26
|
+
maxLength = 5,
|
|
27
|
+
hideHome = false,
|
|
28
|
+
as = 'a',
|
|
29
|
+
homeLinkAriaLabel,
|
|
30
|
+
}) => {
|
|
31
|
+
const totalLength = links.length + +!hideHome;
|
|
32
|
+
const lengthOffset = maxLength - totalLength;
|
|
33
|
+
const isOverflow = lengthOffset < 0;
|
|
34
|
+
|
|
35
|
+
const items = useMemo(
|
|
36
|
+
() =>
|
|
37
|
+
links.map((link, index, items) => {
|
|
38
|
+
const position = index + 1;
|
|
39
|
+
const isLastItem = index === items.length - 1;
|
|
40
|
+
const hidden =
|
|
41
|
+
// We add 1 here to take into account of the truncated breadcrumb.
|
|
42
|
+
position <= Math.abs(lengthOffset) + 1 && isOverflow && !isLastItem;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<BreadcrumbItem
|
|
46
|
+
key={link.label.toString()}
|
|
47
|
+
hidden={hidden}
|
|
48
|
+
hideSeparator={isLastItem}
|
|
49
|
+
position={position + +!hideHome}
|
|
50
|
+
>
|
|
51
|
+
{link.href || isLastItem ? (
|
|
52
|
+
<BreadcrumbLink
|
|
53
|
+
as={as}
|
|
54
|
+
href={link.href || undefined}
|
|
55
|
+
active={isLastItem}
|
|
56
|
+
>
|
|
57
|
+
{link.label}
|
|
58
|
+
</BreadcrumbLink>
|
|
59
|
+
) : (
|
|
60
|
+
<span className="opacity-70">{link.label}</span>
|
|
61
|
+
)}
|
|
62
|
+
</BreadcrumbItem>
|
|
63
|
+
);
|
|
64
|
+
}),
|
|
65
|
+
[hideHome, isOverflow, lengthOffset, links]
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<BreadcrumbRoot>
|
|
70
|
+
{!hideHome && (
|
|
71
|
+
<BreadcrumbItem position={1}>
|
|
72
|
+
<BreadcrumbHomeLink as={as} aria-label={homeLinkAriaLabel} />
|
|
73
|
+
</BreadcrumbItem>
|
|
74
|
+
)}
|
|
75
|
+
{isOverflow && <BreadcrumbTruncatedItem />}
|
|
76
|
+
{items}
|
|
77
|
+
</BreadcrumbRoot>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@reference "../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
> [role='tabpanel'] > :first-child {
|
|
5
|
+
@apply rounded-t-none;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
> div:nth-of-type(1) {
|
|
9
|
+
@apply flex
|
|
10
|
+
rounded-t
|
|
11
|
+
border-x
|
|
12
|
+
border-t
|
|
13
|
+
border-neutral-900
|
|
14
|
+
bg-neutral-950
|
|
15
|
+
px-2
|
|
16
|
+
pt-3
|
|
17
|
+
md:px-4;
|
|
18
|
+
|
|
19
|
+
.trigger {
|
|
20
|
+
@apply border-b
|
|
21
|
+
border-b-transparent
|
|
22
|
+
px-1
|
|
23
|
+
text-neutral-200;
|
|
24
|
+
|
|
25
|
+
&[data-state='active'] {
|
|
26
|
+
@apply border-b-green-400
|
|
27
|
+
text-green-400;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.link {
|
|
32
|
+
@apply hidden
|
|
33
|
+
items-center
|
|
34
|
+
gap-2
|
|
35
|
+
text-center
|
|
36
|
+
text-neutral-200
|
|
37
|
+
motion-safe:transition-colors
|
|
38
|
+
lg:flex;
|
|
39
|
+
|
|
40
|
+
& > .icon {
|
|
41
|
+
@apply size-4
|
|
42
|
+
text-neutral-300;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:is(:link, :visited) {
|
|
46
|
+
&:hover {
|
|
47
|
+
@apply text-neutral-400;
|
|
48
|
+
|
|
49
|
+
& > .icon {
|
|
50
|
+
@apply text-neutral-600;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
3
|
+
import type { FC } from 'react';
|
|
4
|
+
|
|
5
|
+
import BaseCodeBox from '#ui/Common/BaseCodeBox';
|
|
6
|
+
import CodeTabs from '#ui/Common/CodeTabs';
|
|
7
|
+
|
|
8
|
+
type Story = StoryObj<typeof CodeTabs>;
|
|
9
|
+
type Meta = MetaObj<typeof CodeTabs>;
|
|
10
|
+
|
|
11
|
+
const mjsContent = `import * as http from 'http';
|
|
12
|
+
|
|
13
|
+
const hostname = '127.0.0.1';
|
|
14
|
+
const port = 3000;
|
|
15
|
+
|
|
16
|
+
const server = http.createServer((req, res) => {
|
|
17
|
+
res.statusCode = 200;
|
|
18
|
+
res.setHeader('Content-Type', 'text/plain');
|
|
19
|
+
res.end('Hello World');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
server.listen(port, hostname, () => {
|
|
23
|
+
console.log(\`Server running at http://\${hostname}:\${port}/\`);
|
|
24
|
+
});`;
|
|
25
|
+
|
|
26
|
+
const cjsContent = `const http = require('http');
|
|
27
|
+
|
|
28
|
+
const hostname = '127.0.0.1';
|
|
29
|
+
const port = 3000;
|
|
30
|
+
|
|
31
|
+
const server = http.createServer((req, res) => {
|
|
32
|
+
res.statusCode = 200;
|
|
33
|
+
res.setHeader('Content-Type', 'text/plain');
|
|
34
|
+
res.end('Hello World');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
server.listen(port, hostname, () => {
|
|
38
|
+
console.log(\`Server running at http://\${hostname}:\${port}/\`);
|
|
39
|
+
});`;
|
|
40
|
+
|
|
41
|
+
const boxProps = {
|
|
42
|
+
onCopy: console.log,
|
|
43
|
+
buttonText: '[Button Text]',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const TabsContent: FC = () => (
|
|
47
|
+
<>
|
|
48
|
+
<TabsPrimitive.Content key="mjs" value="mjs">
|
|
49
|
+
<BaseCodeBox language="JavaScript (MJS)" {...boxProps}>
|
|
50
|
+
<code>{mjsContent}</code>
|
|
51
|
+
</BaseCodeBox>
|
|
52
|
+
</TabsPrimitive.Content>
|
|
53
|
+
<TabsPrimitive.Content key="cjs" value="cjs">
|
|
54
|
+
<BaseCodeBox language="JavaScript (CJS)" {...boxProps}>
|
|
55
|
+
<code>{cjsContent}</code>
|
|
56
|
+
</BaseCodeBox>
|
|
57
|
+
</TabsPrimitive.Content>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export const Default: Story = {};
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
component: CodeTabs,
|
|
65
|
+
args: {
|
|
66
|
+
children: <TabsContent />,
|
|
67
|
+
defaultValue: 'mjs',
|
|
68
|
+
tabs: [
|
|
69
|
+
{ key: 'mjs', label: 'MJS' },
|
|
70
|
+
{ key: 'cjs', label: 'CJS' },
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
} as Meta;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentProps, FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import Tabs from '#ui/Common/Tabs';
|
|
4
|
+
|
|
5
|
+
import styles from './index.module.css';
|
|
6
|
+
|
|
7
|
+
type CodeTabsProps = Pick<
|
|
8
|
+
ComponentProps<typeof Tabs>,
|
|
9
|
+
'tabs' | 'defaultValue' | 'children' | 'addons'
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
const CodeTabs: FC<CodeTabsProps> = ({ ...props }) => (
|
|
13
|
+
<Tabs {...props} className={styles.root} triggerClassName={styles.trigger} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default CodeTabs;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@reference "../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.dataTag {
|
|
4
|
+
@apply flex
|
|
5
|
+
items-center
|
|
6
|
+
justify-center
|
|
7
|
+
rounded-full
|
|
8
|
+
font-semibold
|
|
9
|
+
text-white;
|
|
10
|
+
|
|
11
|
+
&.lg {
|
|
12
|
+
@apply size-12
|
|
13
|
+
text-2xl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.md {
|
|
17
|
+
@apply size-10
|
|
18
|
+
text-xl;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.sm {
|
|
22
|
+
@apply size-8;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.event {
|
|
26
|
+
@apply bg-accent1-600;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.method {
|
|
30
|
+
@apply bg-info-600;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.property {
|
|
34
|
+
@apply bg-green-600;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.class {
|
|
38
|
+
@apply bg-warning-600;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.module {
|
|
42
|
+
@apply bg-red-600;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.classMethod {
|
|
46
|
+
@apply bg-blue-600;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.ctor {
|
|
50
|
+
@apply bg-accent2-600;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.global {
|
|
54
|
+
@apply bg-amber-600;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import DataTag, { type DataTagProps } from '#ui/Common/DataTag';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof DataTag>;
|
|
6
|
+
type Meta = MetaObj<typeof DataTag>;
|
|
7
|
+
|
|
8
|
+
export const DataTags: Story = {
|
|
9
|
+
render: () => (
|
|
10
|
+
<div className="grid grid-cols-3 gap-6 p-6">
|
|
11
|
+
{[
|
|
12
|
+
'event',
|
|
13
|
+
'method',
|
|
14
|
+
'property',
|
|
15
|
+
'class',
|
|
16
|
+
'module',
|
|
17
|
+
'classMethod',
|
|
18
|
+
'ctor',
|
|
19
|
+
'global',
|
|
20
|
+
]
|
|
21
|
+
.map(kind =>
|
|
22
|
+
['sm', 'md', 'lg'].map(size => (
|
|
23
|
+
<div
|
|
24
|
+
key={`${kind}-${size}`}
|
|
25
|
+
className="flex justify-center"
|
|
26
|
+
title={kind}
|
|
27
|
+
>
|
|
28
|
+
<DataTag
|
|
29
|
+
kind={kind as DataTagProps['kind']}
|
|
30
|
+
size={size as DataTagProps['size']}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
))
|
|
34
|
+
)
|
|
35
|
+
.flat()}
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default { component: DataTag } as Meta;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
|
|
4
|
+
import styles from './index.module.css';
|
|
5
|
+
|
|
6
|
+
export type DataTagProps = {
|
|
7
|
+
kind:
|
|
8
|
+
| 'event'
|
|
9
|
+
| 'method'
|
|
10
|
+
| 'property'
|
|
11
|
+
| 'class'
|
|
12
|
+
| 'module'
|
|
13
|
+
| 'classMethod'
|
|
14
|
+
| 'global'
|
|
15
|
+
| 'ctor';
|
|
16
|
+
size?: 'lg' | 'md' | 'sm';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// These symbols match up with the types used in
|
|
20
|
+
// node core, and the ones defined at
|
|
21
|
+
// https://github.com/nodejs/api-docs-tooling/blob/main/src/types.d.ts#L22 (`HeadingMetadataEntry['type']`)
|
|
22
|
+
const symbolMap = {
|
|
23
|
+
event: 'E',
|
|
24
|
+
method: 'M',
|
|
25
|
+
property: 'P',
|
|
26
|
+
class: 'C',
|
|
27
|
+
module: 'M',
|
|
28
|
+
classMethod: 'S',
|
|
29
|
+
global: 'G',
|
|
30
|
+
ctor: 'C',
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
const DataTag: FC<DataTagProps> = ({ kind, size = 'md' }) => (
|
|
34
|
+
<div className={classNames(styles.dataTag, styles[size], styles[kind])}>
|
|
35
|
+
<span>{symbolMap[kind]}</span>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export default DataTag;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@reference "../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.glowingBackdrop {
|
|
4
|
+
@apply absolute
|
|
5
|
+
left-0
|
|
6
|
+
top-0
|
|
7
|
+
-z-10
|
|
8
|
+
size-full
|
|
9
|
+
opacity-50
|
|
10
|
+
after:absolute
|
|
11
|
+
after:inset-0
|
|
12
|
+
after:m-auto
|
|
13
|
+
after:aspect-square
|
|
14
|
+
after:w-[300px]
|
|
15
|
+
after:rounded-full
|
|
16
|
+
after:bg-green-300
|
|
17
|
+
after:blur-[120px]
|
|
18
|
+
after:content-['']
|
|
19
|
+
md:opacity-100
|
|
20
|
+
dark:after:bg-green-700;
|
|
21
|
+
|
|
22
|
+
svg {
|
|
23
|
+
@apply absolute
|
|
24
|
+
inset-0
|
|
25
|
+
m-auto
|
|
26
|
+
aspect-[1.67]
|
|
27
|
+
max-w-[1004px]
|
|
28
|
+
object-cover
|
|
29
|
+
text-neutral-300
|
|
30
|
+
dark:text-neutral-900/75;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import GlowingBackdrop from '#ui/Common/GlowingBackdrop';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof GlowingBackdrop>;
|
|
6
|
+
type Meta = MetaObj<typeof GlowingBackdrop>;
|
|
7
|
+
|
|
8
|
+
export const Default: Story = {};
|
|
9
|
+
|
|
10
|
+
export default { component: GlowingBackdrop } as Meta;
|