|
| 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 | +}; |
0 commit comments