@node-core/ui-components 1.0.1-6cb8b0a0c75c24f5ccc84bb07a1ea9b4b810abd2 → 1.0.1-6ce9ac9c19dbcf93f5af658cca3784484762d8a3
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 +7 -0
- package/Common/AlertBox/index.stories.tsx +23 -0
- package/Common/AvatarGroup/index.module.css +4 -8
- package/Common/AvatarGroup/index.tsx +1 -5
- package/Common/BaseButton/index.module.css +4 -1
- package/Common/BaseCodeBox/index.module.css +0 -6
- package/Common/BaseCodeBox/index.tsx +7 -18
- package/Common/ChangeHistory/index.module.css +83 -0
- package/Common/ChangeHistory/index.stories.tsx +130 -0
- package/Common/ChangeHistory/index.tsx +67 -0
- package/Common/CodeTabs/index.stories.tsx +1 -2
- 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/Modal/index.module.css +3 -3
- package/Common/Modal/index.stories.tsx +7 -5
- package/Common/Modal/index.tsx +16 -14
- package/Common/Tabs/index.module.css +2 -1
- package/Containers/DocSideBar/index.tsx +0 -0
- package/{Common/ProgressionSidebar/ProgressionSidebarIcon → Containers/Sidebar/ProgressionIcon}/index.tsx +2 -2
- package/Containers/Sidebar/SidebarGroup/index.module.css +54 -16
- package/Containers/Sidebar/SidebarGroup/index.tsx +21 -2
- package/Containers/Sidebar/SidebarItem/index.module.css +39 -18
- package/Containers/Sidebar/SidebarItem/index.tsx +25 -8
- package/Containers/Sidebar/index.module.css +5 -6
- package/Containers/Sidebar/index.stories.tsx +78 -74
- package/Containers/Sidebar/index.tsx +17 -5
- package/Icons/Logos/Nodejs.tsx +201 -17
- package/MDX/CodeTabs.tsx +47 -0
- package/package.json +26 -28
- package/styles/markdown.css +1 -1
- package/Common/ProgressionSidebar/ProgressionSidebarGroup/index.module.css +0 -47
- package/Common/ProgressionSidebar/ProgressionSidebarGroup/index.tsx +0 -35
- package/Common/ProgressionSidebar/ProgressionSidebarItem/index.module.css +0 -39
- package/Common/ProgressionSidebar/ProgressionSidebarItem/index.tsx +0 -32
- package/Common/ProgressionSidebar/index.module.css +0 -30
- package/Common/ProgressionSidebar/index.stories.tsx +0 -79
- package/Common/ProgressionSidebar/index.tsx +0 -59
|
@@ -6,6 +6,12 @@ import AlertBox from '#ui/Common/AlertBox';
|
|
|
6
6
|
type Story = StoryObj<typeof AlertBox>;
|
|
7
7
|
type Meta = MetaObj<typeof AlertBox>;
|
|
8
8
|
|
|
9
|
+
const withMain = (args: React.ComponentProps<typeof AlertBox>) => (
|
|
10
|
+
<main>
|
|
11
|
+
<AlertBox {...args} />
|
|
12
|
+
</main>
|
|
13
|
+
);
|
|
14
|
+
|
|
9
15
|
export const Info: Story = {
|
|
10
16
|
args: {
|
|
11
17
|
level: 'info',
|
|
@@ -46,6 +52,23 @@ export const Danger: Story = {
|
|
|
46
52
|
},
|
|
47
53
|
};
|
|
48
54
|
|
|
55
|
+
export const InMarkdown: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
level: 'danger',
|
|
58
|
+
title: '0',
|
|
59
|
+
children: (
|
|
60
|
+
<>
|
|
61
|
+
In a markdown component, <code>Code renders correctly,</code>{' '}
|
|
62
|
+
<a href="#">
|
|
63
|
+
<code>even when in a link</code>
|
|
64
|
+
</a>
|
|
65
|
+
</>
|
|
66
|
+
),
|
|
67
|
+
size: 'default',
|
|
68
|
+
},
|
|
69
|
+
render: withMain,
|
|
70
|
+
};
|
|
71
|
+
|
|
49
72
|
export const WithIcon: Story = {
|
|
50
73
|
args: {
|
|
51
74
|
level: 'info',
|
|
@@ -4,22 +4,18 @@
|
|
|
4
4
|
@apply flex
|
|
5
5
|
flex-wrap
|
|
6
6
|
items-center;
|
|
7
|
-
|
|
8
|
-
&:not(.expandable) {
|
|
9
|
-
> span {
|
|
10
|
-
@apply ml-0;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
.small {
|
|
16
10
|
> span {
|
|
17
|
-
@apply -ml-2
|
|
11
|
+
@apply -ml-2
|
|
12
|
+
first:ml-0;
|
|
18
13
|
}
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
.medium {
|
|
22
17
|
> span {
|
|
23
|
-
@apply -ml-2.5
|
|
18
|
+
@apply -ml-2.5
|
|
19
|
+
first:ml-0;
|
|
24
20
|
}
|
|
25
21
|
}
|
|
@@ -42,11 +42,7 @@ const AvatarGroup: FC<AvatarGroupProps> = ({
|
|
|
42
42
|
: undefined;
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
|
-
<div
|
|
46
|
-
className={classNames(styles.avatarGroup, styles[size], {
|
|
47
|
-
[styles.expandable]: avatars.length > limit,
|
|
48
|
-
})}
|
|
49
|
-
>
|
|
45
|
+
<div className={classNames(styles.avatarGroup, styles[size])}>
|
|
50
46
|
{renderAvatars.map(avatar => (
|
|
51
47
|
<Tooltip
|
|
52
48
|
key={avatar.nickname}
|
|
@@ -73,11 +73,14 @@
|
|
|
73
73
|
|
|
74
74
|
&.secondary {
|
|
75
75
|
@apply rounded-lg
|
|
76
|
+
border
|
|
77
|
+
border-neutral-200
|
|
76
78
|
text-neutral-800
|
|
79
|
+
dark:border-neutral-900
|
|
77
80
|
dark:text-neutral-200;
|
|
78
81
|
|
|
79
82
|
&:hover:not([aria-disabled='true']) {
|
|
80
|
-
@apply bg-neutral-
|
|
83
|
+
@apply bg-neutral-200
|
|
81
84
|
text-neutral-800
|
|
82
85
|
dark:bg-neutral-900
|
|
83
86
|
dark:text-neutral-200;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
DocumentDuplicateIcon,
|
|
5
|
-
CodeBracketIcon,
|
|
6
|
-
} from '@heroicons/react/24/outline';
|
|
3
|
+
import { DocumentDuplicateIcon } from '@heroicons/react/24/outline';
|
|
7
4
|
import classNames from 'classnames';
|
|
8
|
-
import type { FC, PropsWithChildren, ReactElement
|
|
5
|
+
import type { FC, PropsWithChildren, ReactElement } from 'react';
|
|
9
6
|
import { Fragment, isValidElement, useRef } from 'react';
|
|
10
7
|
|
|
11
8
|
import BaseButton from '#ui/Common/BaseButton';
|
|
@@ -69,10 +66,9 @@ const transformCode = <T extends ReactElement<PropsWithChildren>>(
|
|
|
69
66
|
interface CodeBoxProps {
|
|
70
67
|
language: string;
|
|
71
68
|
className?: string;
|
|
72
|
-
onCopy: (text: string
|
|
69
|
+
onCopy: (text: string) => void;
|
|
73
70
|
as?: LinkLike;
|
|
74
|
-
|
|
75
|
-
copiedText: string;
|
|
71
|
+
buttonText: string;
|
|
76
72
|
showCopyButton?: boolean;
|
|
77
73
|
}
|
|
78
74
|
|
|
@@ -81,8 +77,7 @@ const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
|
|
|
81
77
|
language,
|
|
82
78
|
className,
|
|
83
79
|
onCopy,
|
|
84
|
-
|
|
85
|
-
copyText,
|
|
80
|
+
buttonText,
|
|
86
81
|
as = 'a',
|
|
87
82
|
showCopyButton = true,
|
|
88
83
|
}: PropsWithChildren<CodeBoxProps>) => {
|
|
@@ -91,13 +86,7 @@ const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
|
|
|
91
86
|
const handleCopy = (): void => {
|
|
92
87
|
const text = containerRef.current?.textContent;
|
|
93
88
|
if (text) {
|
|
94
|
-
onCopy(
|
|
95
|
-
text,
|
|
96
|
-
<div className={styles.notification}>
|
|
97
|
-
<CodeBracketIcon className={styles.icon} />
|
|
98
|
-
{copiedText}
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
89
|
+
onCopy(text);
|
|
101
90
|
}
|
|
102
91
|
};
|
|
103
92
|
|
|
@@ -121,7 +110,7 @@ const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
|
|
|
121
110
|
onClick={handleCopy}
|
|
122
111
|
>
|
|
123
112
|
<DocumentDuplicateIcon className={styles.icon} />
|
|
124
|
-
{
|
|
113
|
+
{buttonText}
|
|
125
114
|
</BaseButton>
|
|
126
115
|
)}
|
|
127
116
|
</div>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
@reference "../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.summary {
|
|
4
|
+
@apply outline-hidden
|
|
5
|
+
flex
|
|
6
|
+
h-9
|
|
7
|
+
cursor-pointer
|
|
8
|
+
select-none
|
|
9
|
+
items-center
|
|
10
|
+
gap-2
|
|
11
|
+
rounded-md
|
|
12
|
+
border
|
|
13
|
+
border-neutral-200
|
|
14
|
+
p-2
|
|
15
|
+
text-sm
|
|
16
|
+
text-neutral-700
|
|
17
|
+
motion-safe:transition-colors
|
|
18
|
+
dark:border-neutral-900
|
|
19
|
+
dark:text-neutral-300;
|
|
20
|
+
|
|
21
|
+
&:hover,
|
|
22
|
+
&:focus-visible {
|
|
23
|
+
@apply bg-neutral-100
|
|
24
|
+
dark:bg-neutral-900;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.dropdownContentWrapper {
|
|
29
|
+
@apply absolute
|
|
30
|
+
right-0
|
|
31
|
+
top-full
|
|
32
|
+
z-50
|
|
33
|
+
mt-1
|
|
34
|
+
max-h-80
|
|
35
|
+
w-52
|
|
36
|
+
overflow-hidden
|
|
37
|
+
rounded-sm
|
|
38
|
+
border
|
|
39
|
+
border-neutral-200
|
|
40
|
+
bg-white
|
|
41
|
+
shadow-lg
|
|
42
|
+
dark:border-neutral-900
|
|
43
|
+
dark:bg-neutral-950;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dropdownContentInner {
|
|
47
|
+
@apply max-h-80
|
|
48
|
+
w-52
|
|
49
|
+
overflow-y-auto;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dropdownItem {
|
|
53
|
+
@apply outline-hidden
|
|
54
|
+
block
|
|
55
|
+
px-2.5
|
|
56
|
+
py-1.5
|
|
57
|
+
text-sm
|
|
58
|
+
font-medium
|
|
59
|
+
text-neutral-800
|
|
60
|
+
no-underline
|
|
61
|
+
motion-safe:transition-colors
|
|
62
|
+
dark:text-white;
|
|
63
|
+
|
|
64
|
+
&:hover,
|
|
65
|
+
&:focus-visible {
|
|
66
|
+
@apply bg-green-600
|
|
67
|
+
text-white;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.dropdownLabel {
|
|
72
|
+
@apply block
|
|
73
|
+
text-sm
|
|
74
|
+
font-medium
|
|
75
|
+
leading-tight;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.dropdownVersions {
|
|
79
|
+
@apply block
|
|
80
|
+
text-xs
|
|
81
|
+
leading-tight
|
|
82
|
+
opacity-75;
|
|
83
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import ChangeHistory from '#ui/Common/ChangeHistory';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof ChangeHistory>;
|
|
6
|
+
type Meta = MetaObj<typeof ChangeHistory>;
|
|
7
|
+
|
|
8
|
+
const SAMPLE_CHANGES = [
|
|
9
|
+
{
|
|
10
|
+
versions: ['v15.4.0'],
|
|
11
|
+
label: 'No longer experimental',
|
|
12
|
+
url: 'https://github.com/nodejs/node/pull/12345',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
versions: ['v15.0.0', 'v14.17.0'],
|
|
16
|
+
label: 'Added in v15.0.0, v14.17.0',
|
|
17
|
+
url: 'https://github.com/nodejs/node/pull/67890',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
versions: ['v16.0.0'],
|
|
21
|
+
label: 'Deprecated in 16',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const LARGE_SAMPLE_CHANGES = [
|
|
26
|
+
{
|
|
27
|
+
versions: ['v20.0.0'],
|
|
28
|
+
label: 'Breaking change in v20',
|
|
29
|
+
url: 'https://github.com/nodejs/node/pull/50001',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
versions: ['v19.8.0'],
|
|
33
|
+
label: 'Performance improvement',
|
|
34
|
+
url: 'https://github.com/nodejs/node/pull/49999',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
versions: ['v19.0.0'],
|
|
38
|
+
label: 'API redesign',
|
|
39
|
+
url: 'https://github.com/nodejs/node/pull/49000',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
versions: ['v18.17.0', 'v18.16.1'],
|
|
43
|
+
label: 'Security fix backported',
|
|
44
|
+
url: 'https://github.com/nodejs/node/pull/48500',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
versions: ['v18.0.0'],
|
|
48
|
+
label: 'Major version release',
|
|
49
|
+
url: 'https://github.com/nodejs/node/pull/47000',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
versions: ['v17.9.0'],
|
|
53
|
+
label: 'Experimental feature added',
|
|
54
|
+
url: 'https://github.com/nodejs/node/pull/46500',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
versions: ['v17.0.0'],
|
|
58
|
+
label: 'Node.js 17 release',
|
|
59
|
+
url: 'https://github.com/nodejs/node/pull/45000',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
versions: ['v16.15.0', 'v16.14.2'],
|
|
63
|
+
label: 'Bug fix release',
|
|
64
|
+
url: 'https://github.com/nodejs/node/pull/44000',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
versions: ['v16.0.0'],
|
|
68
|
+
label: 'Deprecated in v16',
|
|
69
|
+
url: 'https://github.com/nodejs/node/pull/43000',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
versions: ['v15.14.0'],
|
|
73
|
+
label: 'Feature enhancement',
|
|
74
|
+
url: 'https://github.com/nodejs/node/pull/42000',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
versions: ['v15.0.0', 'v14.17.0'],
|
|
78
|
+
label: 'Initial implementation',
|
|
79
|
+
url: 'https://github.com/nodejs/node/pull/41000',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
versions: ['v14.18.0'],
|
|
83
|
+
label: 'Documentation update',
|
|
84
|
+
url: 'https://github.com/nodejs/node/pull/40000',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
versions: ['v14.0.0'],
|
|
88
|
+
label: 'Added to stable API',
|
|
89
|
+
url: 'https://github.com/nodejs/node/pull/39000',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
versions: ['v13.14.0'],
|
|
93
|
+
label: 'Experimental flag removed',
|
|
94
|
+
url: 'https://github.com/nodejs/node/pull/38000',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
versions: ['v12.22.0', 'v12.21.0'],
|
|
98
|
+
label: 'Backported to LTS',
|
|
99
|
+
url: 'https://github.com/nodejs/node/pull/37000',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
versions: ['v12.0.0'],
|
|
103
|
+
label: 'First experimental version',
|
|
104
|
+
url: 'https://github.com/nodejs/node/pull/36000',
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
export const Default: Story = {
|
|
109
|
+
render: args => (
|
|
110
|
+
<div className="right-0 flex justify-end">
|
|
111
|
+
<ChangeHistory {...args} />
|
|
112
|
+
</div>
|
|
113
|
+
),
|
|
114
|
+
args: {
|
|
115
|
+
changes: SAMPLE_CHANGES,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const LargeHistory: Story = {
|
|
120
|
+
render: args => (
|
|
121
|
+
<div className="right-0 flex justify-end">
|
|
122
|
+
<ChangeHistory {...args} />
|
|
123
|
+
</div>
|
|
124
|
+
),
|
|
125
|
+
args: {
|
|
126
|
+
changes: LARGE_SAMPLE_CHANGES,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export default { component: ChangeHistory } as Meta;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ChevronDownIcon, ClockIcon } from '@heroicons/react/24/outline';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import type { FC, ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
import type { LinkLike } from '#ui/types.js';
|
|
6
|
+
|
|
7
|
+
import styles from './index.module.css';
|
|
8
|
+
|
|
9
|
+
export type HistoryChange = {
|
|
10
|
+
versions: Array<string>;
|
|
11
|
+
label: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type ChangeHistoryProps = ComponentProps<'div'> & {
|
|
16
|
+
label: string;
|
|
17
|
+
changes: Array<HistoryChange>;
|
|
18
|
+
as?: LinkLike;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ChangeHistory: FC<ChangeHistoryProps> = ({
|
|
22
|
+
label = 'History',
|
|
23
|
+
changes = [],
|
|
24
|
+
className,
|
|
25
|
+
as: As = 'a',
|
|
26
|
+
'aria-label': ariaLabel = label,
|
|
27
|
+
...props
|
|
28
|
+
}) => (
|
|
29
|
+
<div className={classNames('relative', 'inline-block', className)} {...props}>
|
|
30
|
+
<details className="group">
|
|
31
|
+
<summary className={styles.summary} role="button" aria-haspopup="menu">
|
|
32
|
+
<ClockIcon className="size-4" />
|
|
33
|
+
<span>{label}</span>
|
|
34
|
+
<ChevronDownIcon className="size-3 group-open:rotate-180 motion-safe:transition-transform" />
|
|
35
|
+
</summary>
|
|
36
|
+
<div
|
|
37
|
+
className={styles.dropdownContentWrapper}
|
|
38
|
+
role="menu"
|
|
39
|
+
aria-label={ariaLabel}
|
|
40
|
+
>
|
|
41
|
+
<div className={styles.dropdownContentInner}>
|
|
42
|
+
{changes.map((change, index) => {
|
|
43
|
+
const MenuItem = change.url ? As : 'div';
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<MenuItem
|
|
47
|
+
key={index}
|
|
48
|
+
className={styles.dropdownItem}
|
|
49
|
+
role="menuitem"
|
|
50
|
+
tabIndex={0}
|
|
51
|
+
aria-label={`${change.label}: ${change.versions.join(', ')}`}
|
|
52
|
+
href={change.url}
|
|
53
|
+
>
|
|
54
|
+
<div className={styles.dropdownLabel}>{change.label}</div>
|
|
55
|
+
<div className={styles.dropdownVersions}>
|
|
56
|
+
{change.versions.join(', ')}
|
|
57
|
+
</div>
|
|
58
|
+
</MenuItem>
|
|
59
|
+
);
|
|
60
|
+
})}
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</details>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export default ChangeHistory;
|
|
@@ -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;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
w-full
|
|
18
18
|
max-w-3xl
|
|
19
19
|
flex-col
|
|
20
|
+
gap-2
|
|
20
21
|
overflow-y-auto
|
|
21
22
|
rounded
|
|
22
23
|
border
|
|
@@ -47,8 +48,7 @@
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
.title {
|
|
50
|
-
@apply
|
|
51
|
-
text-3xl
|
|
51
|
+
@apply text-3xl
|
|
52
52
|
font-semibold
|
|
53
53
|
text-neutral-900
|
|
54
54
|
dark:text-white;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
|
|
57
57
|
.description {
|
|
58
58
|
@apply font-regular
|
|
59
|
-
mb-
|
|
59
|
+
mb-2
|
|
60
60
|
text-lg
|
|
61
61
|
text-neutral-800
|
|
62
62
|
dark:text-neutral-200;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import Modal from '#ui/Common/Modal';
|
|
3
|
+
import { Modal, Title, Description, Content } from '#ui/Common/Modal';
|
|
4
4
|
|
|
5
5
|
type Story = StoryObj<typeof Modal>;
|
|
6
6
|
type Meta = MetaObj<typeof Modal>;
|
|
@@ -8,10 +8,12 @@ type Meta = MetaObj<typeof Modal>;
|
|
|
8
8
|
export const Default: Story = {
|
|
9
9
|
args: {
|
|
10
10
|
open: true,
|
|
11
|
-
heading: 'Node.js Versions Information',
|
|
12
|
-
subheading: 'Get all information about Node.js versions and their changes.',
|
|
13
11
|
children: (
|
|
14
|
-
|
|
12
|
+
<Content>
|
|
13
|
+
<Title>Node.js Versions Information</Title>
|
|
14
|
+
<Description>
|
|
15
|
+
Get all information about Node.js versions and their changes.
|
|
16
|
+
</Description>
|
|
15
17
|
<p>
|
|
16
18
|
Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto
|
|
17
19
|
atque sint doloremque, sapiente recusandae debitis libero nostrum
|
|
@@ -24,7 +26,7 @@ export const Default: Story = {
|
|
|
24
26
|
amet minus sit architecto blanditiis hic sed odit cumque numquam
|
|
25
27
|
dignissimos delectus.
|
|
26
28
|
</p>
|
|
27
|
-
|
|
29
|
+
</Content>
|
|
28
30
|
),
|
|
29
31
|
},
|
|
30
32
|
};
|