Skip to content

Commit 03f5ffc

Browse files
authored
chore: UX improvements (#8561)
chore: ux improvements
1 parent 17546fc commit 03f5ffc

File tree

11 files changed

+138
-19
lines changed

11 files changed

+138
-19
lines changed

packages/ui-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@node-core/ui-components",
3-
"version": "1.5.6",
3+
"version": "1.5.7",
44
"type": "module",
55
"exports": {
66
"./*": [

packages/ui-components/src/Common/AlertBox/index.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
size-5;
5151
}
5252

53+
.content {
54+
@apply wrap-anywhere;
55+
}
56+
5357
&.info {
5458
@apply bg-info-600;
5559

packages/ui-components/src/Common/AlertBox/index.stories.tsx

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,6 @@ export const NoTitle: Story = {
111111
},
112112
};
113113

114-
export default {
115-
component: AlertBox,
116-
argTypes: {
117-
size: {
118-
options: ['default', 'small'],
119-
control: { type: 'radio' },
120-
},
121-
},
122-
} as Meta;
123-
124114
export const SmallContainer: Story = {
125115
render: args => (
126116
<div className="w-200">
@@ -141,3 +131,58 @@ export const SmallContainer: Story = {
141131
size: 'default',
142132
},
143133
};
134+
135+
export const WithLongContent: Story = {
136+
args: {
137+
level: 'warning',
138+
title: 'Stability: 1',
139+
children: (
140+
<span>
141+
Experimental. Please migrate away from this API, if you can. We do not
142+
recommend using the{' '}
143+
<a href="#async_hookscreatehookcallbacks">
144+
<code>createHook</code>
145+
</a>
146+
,{' '}
147+
<a href="#class-asynchook">
148+
<code>AsyncHook</code>
149+
</a>
150+
, and
151+
<a href="#async_hooksexecutionasyncresource">
152+
<code>executionAsyncResource</code>
153+
</a>{' '}
154+
APIs as they have usability issues, safety risks, and performance
155+
implications. Async context tracking use cases are better served by the
156+
stable{' '}
157+
<a href="async_context.html#class-asynclocalstorage">
158+
<code>AsyncLocalStorage</code>
159+
</a>{' '}
160+
API. If you have a use case for
161+
<code>createHook</code>, <code>AsyncHook</code>, or{' '}
162+
<code>executionAsyncResource</code> beyond the context tracking need
163+
solved by{' '}
164+
<a href="async_context.html#class-asynclocalstorage">
165+
<code>AsyncLocalStorage</code>
166+
</a>{' '}
167+
or diagnostics data currently provided by{' '}
168+
<a href="diagnostics_channel.html">Diagnostics Channel</a>, please open
169+
an issue at{' '}
170+
<a href="https://github.com/nodejs/node/issues">
171+
https://github.com/nodejs/node/issues
172+
</a>{' '}
173+
describing your use case so we can create a more purpose-focused API.
174+
</span>
175+
),
176+
size: 'default',
177+
},
178+
};
179+
180+
export default {
181+
component: AlertBox,
182+
argTypes: {
183+
size: {
184+
options: ['default', 'small'],
185+
control: { type: 'radio' },
186+
},
187+
},
188+
} as Meta;

packages/ui-components/src/Common/AlertBox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const AlertBox: FC<AlertBoxProps> = ({
1818
}) => (
1919
<div className={classNames(styles.alertBox, styles[level], styles[size])}>
2020
<span className={styles.title}>{title}</span>
21-
<span>{children}</span>
21+
<span className={styles.content}>{children}</span>
2222
</div>
2323
);
2424

packages/ui-components/src/Common/Badge/index.module.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,20 @@
3737
&.neutral {
3838
@apply bg-neutral-800;
3939
}
40+
41+
&.circular {
42+
@apply font-ibm-plex-mono
43+
inline-flex
44+
items-center
45+
justify-center
46+
p-0;
47+
48+
&.small {
49+
@apply size-5;
50+
}
51+
52+
&.medium {
53+
@apply size-7;
54+
}
55+
}
4056
}

packages/ui-components/src/Common/Badge/index.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,21 @@ export const Medium: Story = {
4747
},
4848
};
4949

50+
export const Circular: Story = {
51+
args: {
52+
circular: true,
53+
children: 'D',
54+
size: 'small',
55+
kind: 'error',
56+
},
57+
};
58+
59+
export const MediumCircular: Story = {
60+
args: {
61+
circular: true,
62+
children: 'E',
63+
kind: 'warning',
64+
},
65+
};
66+
5067
export default { component: Badge, args: { children: 'Badge' } } as Meta;

packages/ui-components/src/Common/Badge/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@ type BadgeSize = 'small' | 'medium';
1010
type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
1111
size?: BadgeSize;
1212
kind?: BadgeKind;
13+
circular?: boolean;
1314
};
1415

1516
const Badge: FC<PropsWithChildren<BadgeProps>> = ({
1617
kind = 'default',
1718
size = 'medium',
19+
circular = false,
1820
className,
1921
children,
2022
...props
2123
}) => (
2224
<span
23-
className={classNames(styles.badge, styles[kind], styles[size], className)}
25+
className={classNames(
26+
styles.badge,
27+
styles[kind],
28+
styles[size],
29+
{ [styles.circular]: circular },
30+
className
31+
)}
2432
{...props}
2533
>
2634
{children}

packages/ui-components/src/Common/DataTag/index.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@reference "../../styles/index.css";
22

33
.dataTag {
4-
@apply flex
4+
@apply font-ibm-plex-mono
5+
flex
56
items-center
67
justify-center
78
rounded-full

packages/ui-components/src/Common/TableOfContents/index.module.css

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,39 @@
88
lg:hidden
99
dark:bg-neutral-900;
1010

11+
&[open] {
12+
.icon {
13+
@apply rotate-90;
14+
}
15+
}
16+
1117
.summary {
12-
@apply px-4
13-
py-2;
18+
@apply flex
19+
list-none
20+
items-center
21+
gap-1
22+
px-3.5
23+
py-2.5;
24+
25+
&::-webkit-details-marker {
26+
@apply hidden;
27+
}
28+
29+
.icon {
30+
@apply size-5;
31+
}
1432
}
1533

1634
.list {
1735
@apply space-y-1
1836
px-4
19-
pb-2;
37+
pb-2
38+
wrap-anywhere;
2039
}
2140

2241
.link {
23-
@apply text-sm
42+
@apply inline-block
43+
text-sm
2444
font-semibold
2545
text-neutral-900
2646
underline

packages/ui-components/src/Common/TableOfContents/index.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export default {
6060
depth: 5, // h5s do not get shown
6161
data: { id: 'node-website' },
6262
},
63+
{
64+
value: 'ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION',
65+
depth: 3,
66+
data: { id: 'err_duplicate_startup_snapshot_main_function' },
67+
},
6368
],
6469
},
6570
} as Meta;

0 commit comments

Comments
 (0)