@node-core/ui-components 0.0.1 → 1.0.1-df203d0fe21ee5d80d258c60dc821e8ac0601ce4
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 +84 -0
- package/Common/BaseCodeBox/index.stories.tsx +39 -0
- package/Common/BaseCodeBox/index.tsx +133 -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 +74 -0
- package/Common/CodeTabs/index.tsx +16 -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/package.json +89 -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,74 @@
|
|
|
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
|
+
copyText: '[Copy Text]',
|
|
44
|
+
copiedText: '[Copied Text]',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const TabsContent: FC = () => (
|
|
48
|
+
<>
|
|
49
|
+
<TabsPrimitive.Content key="mjs" value="mjs">
|
|
50
|
+
<BaseCodeBox language="JavaScript (MJS)" {...boxProps}>
|
|
51
|
+
<code>{mjsContent}</code>
|
|
52
|
+
</BaseCodeBox>
|
|
53
|
+
</TabsPrimitive.Content>
|
|
54
|
+
<TabsPrimitive.Content key="cjs" value="cjs">
|
|
55
|
+
<BaseCodeBox language="JavaScript (CJS)" {...boxProps}>
|
|
56
|
+
<code>{cjsContent}</code>
|
|
57
|
+
</BaseCodeBox>
|
|
58
|
+
</TabsPrimitive.Content>
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export const Default: Story = {};
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
component: CodeTabs,
|
|
66
|
+
args: {
|
|
67
|
+
children: <TabsContent />,
|
|
68
|
+
defaultValue: 'mjs',
|
|
69
|
+
tabs: [
|
|
70
|
+
{ key: 'mjs', label: 'MJS' },
|
|
71
|
+
{ key: 'cjs', label: 'CJS' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
} 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,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;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import HexagonGrid from '#ui/Icons/HexagonGrid';
|
|
4
|
+
|
|
5
|
+
import styles from './index.module.css';
|
|
6
|
+
|
|
7
|
+
const GlowingBackdrop: FC = () => (
|
|
8
|
+
<div className={styles.glowingBackdrop}>
|
|
9
|
+
<HexagonGrid />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export default GlowingBackdrop;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@reference "../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.languageDropdown {
|
|
4
|
+
@apply h-9
|
|
5
|
+
w-9
|
|
6
|
+
rounded-md
|
|
7
|
+
p-2
|
|
8
|
+
text-neutral-700
|
|
9
|
+
motion-safe:transition-colors
|
|
10
|
+
dark:text-neutral-300;
|
|
11
|
+
|
|
12
|
+
&:hover {
|
|
13
|
+
@apply bg-neutral-100
|
|
14
|
+
dark:bg-neutral-900;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dropDownContent {
|
|
19
|
+
@apply max-h-80
|
|
20
|
+
w-48
|
|
21
|
+
overflow-hidden
|
|
22
|
+
rounded-sm
|
|
23
|
+
border
|
|
24
|
+
border-neutral-200
|
|
25
|
+
bg-white
|
|
26
|
+
shadow-lg
|
|
27
|
+
dark:border-neutral-900
|
|
28
|
+
dark:bg-neutral-950;
|
|
29
|
+
|
|
30
|
+
> div {
|
|
31
|
+
@apply max-h-80
|
|
32
|
+
w-48
|
|
33
|
+
overflow-y-auto;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dropDownItem {
|
|
38
|
+
@apply outline-hidden
|
|
39
|
+
cursor-pointer
|
|
40
|
+
px-2.5
|
|
41
|
+
py-1.5
|
|
42
|
+
text-sm
|
|
43
|
+
font-medium
|
|
44
|
+
text-neutral-800
|
|
45
|
+
data-[highlighted]:bg-green-600
|
|
46
|
+
data-[highlighted]:text-white
|
|
47
|
+
dark:text-white;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.currentDropDown {
|
|
51
|
+
@apply bg-green-600
|
|
52
|
+
text-white;
|
|
53
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import LanguageDropDown from '#ui/Common/LanguageDropDown';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof LanguageDropDown>;
|
|
6
|
+
type Meta = MetaObj<typeof LanguageDropDown>;
|
|
7
|
+
|
|
8
|
+
export const Default: Story = {
|
|
9
|
+
args: {
|
|
10
|
+
availableLanguages: [
|
|
11
|
+
{ name: 'English', code: 'en', localName: 'English' },
|
|
12
|
+
{ name: 'French', code: 'fr', localName: 'Français' },
|
|
13
|
+
{ name: 'Spanish', code: 'es', localName: 'Español' },
|
|
14
|
+
],
|
|
15
|
+
currentLanguage: 'en',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default { component: LanguageDropDown } as Meta;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LanguageIcon } from '@heroicons/react/24/outline';
|
|
2
|
+
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import type { FC } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { SimpleLocaleConfig } from '#ui/types';
|
|
7
|
+
|
|
8
|
+
import styles from './index.module.css';
|
|
9
|
+
|
|
10
|
+
type LanguageDropDownProps = {
|
|
11
|
+
onChange?: (newLocale: SimpleLocaleConfig) => void;
|
|
12
|
+
currentLanguage: string;
|
|
13
|
+
availableLanguages: Array<SimpleLocaleConfig>;
|
|
14
|
+
ariaLabel: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const LanguageDropdown: FC<LanguageDropDownProps> = ({
|
|
18
|
+
onChange = () => {},
|
|
19
|
+
currentLanguage,
|
|
20
|
+
availableLanguages,
|
|
21
|
+
ariaLabel,
|
|
22
|
+
}) => {
|
|
23
|
+
return (
|
|
24
|
+
<DropdownMenu.Root>
|
|
25
|
+
<DropdownMenu.Trigger asChild>
|
|
26
|
+
<button className={styles.languageDropdown} aria-label={ariaLabel}>
|
|
27
|
+
<LanguageIcon height="20" />
|
|
28
|
+
</button>
|
|
29
|
+
</DropdownMenu.Trigger>
|
|
30
|
+
|
|
31
|
+
<DropdownMenu.Portal>
|
|
32
|
+
<DropdownMenu.Content
|
|
33
|
+
align="start"
|
|
34
|
+
className={styles.dropDownContent}
|
|
35
|
+
sideOffset={5}
|
|
36
|
+
>
|
|
37
|
+
<div>
|
|
38
|
+
{availableLanguages.map(({ name, code, localName }) => (
|
|
39
|
+
<DropdownMenu.Item
|
|
40
|
+
key={code}
|
|
41
|
+
onClick={() => onChange({ name, code, localName })}
|
|
42
|
+
className={classNames(styles.dropDownItem, {
|
|
43
|
+
[styles.currentDropDown]: code === currentLanguage,
|
|
44
|
+
})}
|
|
45
|
+
>
|
|
46
|
+
{localName}
|
|
47
|
+
</DropdownMenu.Item>
|
|
48
|
+
))}
|
|
49
|
+
</div>
|
|
50
|
+
</DropdownMenu.Content>
|
|
51
|
+
</DropdownMenu.Portal>
|
|
52
|
+
</DropdownMenu.Root>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default LanguageDropdown;
|