Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/crisp-socks-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@node-core/ui-components': patch
---

In the light theme, the background color of items in the history change component that contain code elements is incorrect when hovering.
2 changes: 1 addition & 1 deletion packages/ui-components/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const preview: Preview = {

decorators: [
withThemeByDataAttribute<ReactRenderer>({
themes: { light: '', dark: 'dark' },
themes: { light: 'light', dark: 'dark' },

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add specific attribute values ​​to ensure that the newly added class can be matched in the storybook.

defaultTheme: 'light',
attributeName: 'data-theme',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
@apply bg-brand-600
text-white!;
}

/* Keep inline `code` readable in light theme, where hover/focus turns text white */
:where([data-theme='light'], [data-theme='light'] *)
&:is(:hover, :focus-visible)
code {
@apply text-brand-900;
}
}

.dropdownLabel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const SAMPLE_CHANGES = [
{
versions: ['v15.0.0', 'v14.17.0'],
label: 'Added in v15.0.0, v14.17.0',
content: (
<>
Added in: <code>v15.0.0</code>, <code>v14.17.0</code>
</>
),
url: 'https://github.com/nodejs/node/pull/67890',
},
{
Expand Down Expand Up @@ -107,9 +112,13 @@ const LARGE_SAMPLE_CHANGES = [

export const Default: Story = {
render: args => (
<div className="right-0 flex justify-end">
<ChangeHistory {...args} />
</div>
// `main` reproduces the docs page context: markdown.css scopes inline
// `code` styles under `main`, which is what the hover fix interacts with /ui-components/src/styles/markdown.css
<main>
<div className="flex justify-end">
<ChangeHistory {...args} />
</div>
</main>
),
args: {
changes: SAMPLE_CHANGES,
Expand All @@ -118,9 +127,11 @@ export const Default: Story = {

export const LargeHistory: Story = {
render: args => (
<div className="right-0 flex justify-end">
<ChangeHistory {...args} />
</div>
<main>
<div className="flex justify-end">
<ChangeHistory {...args} />
</div>
</main>
),
args: {
changes: LARGE_SAMPLE_CHANGES,
Expand Down