Skip to content

Commit c416123

Browse files
committed
Add insights chip
1 parent 83ce8fa commit c416123

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import Icon from '@leafygreen-ui/icon';
2+
import React from 'react';
3+
import { Chip } from '@leafygreen-ui/chip';
4+
import { css, cx } from '@leafygreen-ui/emotion';
5+
import { fontWeights } from '@leafygreen-ui/tokens';
6+
import { palette } from '@leafygreen-ui/palette';
7+
import { useDarkMode } from '../hooks/use-theme';
8+
9+
const chipLightModeStyles = css({
10+
'--chipBackgroundColor': palette.blue.light3,
11+
'--chipBorderColor': palette.blue.light2,
12+
'--chipColor': palette.blue.dark1,
13+
});
14+
15+
const chipDarkModeStyles = css({
16+
'--chipBackgroundColor': palette.blue.dark2,
17+
'--chipBorderColor': palette.blue.dark1,
18+
'--chipColor': palette.blue.light2,
19+
});
20+
21+
const chipStyles = css({
22+
fontWeight: fontWeights.bold,
23+
textTransform: 'uppercase',
24+
color: 'var(--chipColor)',
25+
backgroundColor: 'var(--chipBackgroundColor)',
26+
});
27+
28+
export const InsightsChip = () => {
29+
const isDarkMode = useDarkMode();
30+
return (
31+
<Chip
32+
className={cx(
33+
isDarkMode
34+
? [chipDarkModeStyles, chipStyles]
35+
: [chipLightModeStyles, chipStyles]
36+
)}
37+
label="insight"
38+
glyph={<Icon glyph="Bulb" />}
39+
/>
40+
);
41+
};

packages/compass-components/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,4 @@ export {
212212
} from './components/virtual-list';
213213
export { SelectTable } from './components/select-table';
214214
export { ParagraphSkeleton } from '@leafygreen-ui/skeleton-loader';
215+
export { InsightsChip } from './components/insights-chip';

0 commit comments

Comments
 (0)