Skip to content

Commit 2668054

Browse files
committed
fix(code): don't rely on inherited text color
Signed-off-by: Aviv Keller <me@aviv.sh>
1 parent 65f87ed commit 2668054

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@
1111
text-sm
1212
text-white;
1313

14-
a {
15-
@apply font-bold
16-
text-white
17-
underline
18-
hover:text-white;
19-
20-
&:hover {
21-
@apply no-underline;
22-
}
23-
}
24-
2514
&.small {
2615
@apply gap-1
2716
py-2

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import AlertBox from '#ui/Common/AlertBox';
66
type Story = StoryObj<typeof AlertBox>;
77
type Meta = MetaObj<typeof AlertBox>;
88

9+
const withMain = (args: React.ComponentProps<typeof AlertBox>) => (
10+
<main>
11+
<AlertBox {...args} />
12+
</main>
13+
);
14+
915
export const Info: Story = {
1016
args: {
1117
level: 'info',
@@ -46,6 +52,23 @@ export const Danger: Story = {
4652
},
4753
};
4854

55+
export const InMarkdown: Story = {
56+
args: {
57+
level: 'danger',
58+
title: '0',
59+
children: (
60+
<>
61+
<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+
4972
export const WithIcon: Story = {
5073
args: {
5174
level: 'info',

packages/ui-components/styles/markdown.css

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ main {
7272
}
7373

7474
/* link that isn't inside a heading */
75-
a:not(h1 > a):not(h2 > a):not(h3 > a):not(h4 > a):not(h5 > a):not(h6 > a),
76-
.anchor {
75+
a:not(h1 > a):not(h2 > a):not(h3 > a):not(h4 > a):not(h5 > a):not(h6 > a) {
7776
@apply max-xs:font-semibold
7877
text-green-600
7978
dark:text-green-400;
@@ -87,13 +86,8 @@ main {
8786
@apply max-xs:font-regular;
8887
}
8988

90-
&:has(code) {
91-
@apply max-xs:decoration-neutral-800
92-
dark:max-xs:decoration-neutral-200;
93-
94-
code {
95-
@apply text-inherit;
96-
}
89+
code {
90+
@apply text-inherit;
9791
}
9892
}
9993

0 commit comments

Comments
 (0)