Skip to content

Commit 5008087

Browse files
authored
[LG-5684] fix(rich-links): update colors for RichLinkBadge component (#3283)
* refactor(rich-links): refactor darkmode propagation and update some colors * test(rich-links): enable darkmode in rich-links stories * chore: changesets
1 parent 1d63f1f commit 5008087

File tree

4 files changed

+47
-24
lines changed

4 files changed

+47
-24
lines changed

.changeset/kind-goats-pump.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@lg-chat/rich-links': patch
3+
'@lg-chat/message': patch
4+
---
5+
6+
[LG-5684](https://jira.mongodb.org/browse/LG-5684): update colors used for `RichLinkBadge` component which is used in `Message.Links`

chat/rich-links/src/RichLink/RichLink.stories.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
import React from 'react';
2+
import { storybookArgTypes } from '@lg-tools/storybook-utils';
23
import { StoryFn } from '@storybook/react';
34

5+
import LeafyGreenProvider from '@leafygreen-ui/leafygreen-provider';
6+
47
import { RichLink } from '.';
58

69
export default {
710
title: 'Composition/Chat/RichLink',
811
component: RichLink,
12+
argTypes: {
13+
darkMode: storybookArgTypes.darkMode,
14+
},
15+
decorators: [
16+
(Story: StoryFn, context) => {
17+
return (
18+
<LeafyGreenProvider darkMode={context?.args.darkMode}>
19+
<Story />
20+
</LeafyGreenProvider>
21+
);
22+
},
23+
],
924
};
1025

1126
const Template: StoryFn<typeof RichLink> = props => (

chat/rich-links/src/RichLink/RichLink.tsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import React, { forwardRef } from 'react';
22

33
import { Card } from '@leafygreen-ui/card';
44
import { cx } from '@leafygreen-ui/emotion';
5-
import { useDarkMode } from '@leafygreen-ui/leafygreen-provider';
5+
import LeafyGreenProvider, {
6+
useDarkMode,
7+
} from '@leafygreen-ui/leafygreen-provider';
68
import { PolymorphicAs } from '@leafygreen-ui/polymorphic';
79
import { Body } from '@leafygreen-ui/typography';
810

@@ -52,25 +54,25 @@ export const RichLink = forwardRef<HTMLAnchorElement, RichLinkProps>(
5254
: {};
5355

5456
return (
55-
<Card
56-
darkMode={darkMode}
57-
className={cx(baseStyles, themeStyles[theme])}
58-
title={children}
59-
{...conditionalProps}
60-
onClick={() => onLinkClick?.(props)}
61-
>
62-
<Body as="span" className={richLinkTextClassName} darkMode={darkMode}>
63-
{children}
64-
</Body>
65-
{showBadge ? (
66-
<RichLinkBadge
67-
darkMode={darkMode}
68-
color={badgeColor}
69-
label={badgeLabel}
70-
glyph={badgeGlyph}
71-
/>
72-
) : null}
73-
</Card>
57+
<LeafyGreenProvider darkMode={darkMode}>
58+
<Card
59+
className={cx(baseStyles, themeStyles[theme])}
60+
title={children}
61+
{...conditionalProps}
62+
onClick={() => onLinkClick?.(props)}
63+
>
64+
<Body as="span" className={richLinkTextClassName}>
65+
{children}
66+
</Body>
67+
{showBadge ? (
68+
<RichLinkBadge
69+
color={badgeColor}
70+
label={badgeLabel}
71+
glyph={badgeGlyph}
72+
/>
73+
) : null}
74+
</Card>
75+
</LeafyGreenProvider>
7476
);
7577
},
7678
);

chat/rich-links/src/RichLink/RichLinkBadge/RichLinkBadge.styles.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ export const badgeVariants: Record<
2222
> = {
2323
[Theme.Dark]: {
2424
[RichLinkBadgeColors.Gray]: css`
25-
background-color: ${palette.gray.dark1};
25+
background-color: ${palette.gray.dark2};
2626
& svg {
27-
color: ${palette.gray.light3};
27+
color: ${palette.gray.light1};
2828
}
2929
& p {
30-
color: ${palette.gray.light3};
30+
color: ${palette.gray.light2};
3131
}
3232
`,
3333
[RichLinkBadgeColors.Blue]: css`
@@ -92,7 +92,7 @@ export const badgeVariants: Record<
9292
color: ${palette.blue.dark2};
9393
}
9494
& p {
95-
color: ${palette.blue.dark1};
95+
color: ${palette.blue.dark3};
9696
}
9797
`,
9898
[RichLinkBadgeColors.Green]: css`

0 commit comments

Comments
 (0)