Skip to content

Commit f2691db

Browse files
author
Luke Bowerman
authored
Tooltip uses theme slots for background, type and link (#988)
1 parent e1462a1 commit f2691db

File tree

6 files changed

+64
-8
lines changed

6 files changed

+64
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
- `Badge` - `default` intent is now `key`
3232
- `CheckboxGroup` and `RadioGroup` `name` is now optional
3333
- Updated `LookerLogo` and `LogoRings` to match new branding
34+
- `Tooltip` now uses `keyAccent` for link color
3435

3536
### Fixed
3637

packages/components/src/Tooltip/Tooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ export function useTooltip({
214214
ref={ref}
215215
style={style}
216216
zIndex={CustomizableTooltipAttributes.zIndex}
217-
backgroundColor="palette.charcoal600"
217+
backgroundColor="inverse"
218218
borderRadius="medium"
219219
boxShadow={3}
220-
color="palette.charcoal000"
220+
color="inverseText"
221221
{...surfaceStyles}
222222
>
223223
<TooltipContent

packages/components/src/Tooltip/TooltipContent.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ export const TooltipContent = styled(Paragraph).attrs(
4444
overflow-wrap: anywhere;
4545
4646
${Link} {
47-
color: ${(props) => props.theme.colors.palette.blue200};
47+
color: ${(props) => props.theme.colors.keyAccent};
4848
text-decoration: underline;
4949
5050
&:focus,
5151
&:hover {
52-
color: ${(props) => props.theme.colors.palette.blue100};
52+
color: ${(props) => props.theme.colors.keySubtle};
53+
}
54+
55+
&:active {
56+
color: ${(props) => props.theme.colors.keyText};
5357
}
5458
}
5559
`

packages/design-tokens/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export * from './GlobalStyle'
3232
/**
3333
* @TODO - This should not be directly exported or utilized. It should be consumed via theme.
3434
*/
35-
export { palette } from './tokens'
35+
export { palette } from './tokens/color/palette'
3636

3737
// Useful external helpers
3838
export * from './customizeable_attributes'

packages/design-tokens/src/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ import {
5050
fontSizes,
5151
fontWeights,
5252
lineHeights,
53-
palette,
5453
radii,
5554
colors,
5655
shadows,
5756
space,
5857
transitions,
5958
} from './tokens'
59+
import { palette } from './tokens/color/palette'
6060

6161
interface ThemeColors extends Colors {
6262
palette: Palette

packages/design-tokens/src/tokens/color/index.ts

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,56 @@
2424
2525
*/
2626

27-
export * from './palette'
28-
export * from './colors'
27+
import { IntentColors, SurfaceColors } from '../../system/color/specifiable'
28+
import { CoreColors, Colors, SpecifiableColors } from '../../system'
29+
import { palette } from './palette'
30+
import { fallbackBlends, fallbackStateful } from './fallbacks'
31+
32+
const {
33+
blue500,
34+
blue600,
35+
charcoal400,
36+
charcoal800,
37+
green500,
38+
purple400,
39+
red500,
40+
yellow500,
41+
white,
42+
} = palette
43+
44+
/* eslint-disable sort-keys-fix/sort-keys-fix */
45+
46+
const defaultCoreColors: CoreColors = {
47+
background: white,
48+
text: charcoal800,
49+
key: purple400,
50+
}
51+
52+
const generateSurfaceColors = (coreColors: CoreColors): SurfaceColors => {
53+
return {
54+
field: coreColors.background,
55+
inverse: coreColors.text,
56+
inverseText: coreColors.background,
57+
}
58+
}
59+
60+
const defaultIntentColors: IntentColors = {
61+
link: blue600,
62+
critical: red500,
63+
warn: yellow500,
64+
neutral: charcoal400,
65+
positive: green500,
66+
inform: blue500,
67+
}
68+
69+
const specifiableColors: SpecifiableColors = {
70+
...defaultCoreColors,
71+
...generateSurfaceColors(defaultCoreColors),
72+
...defaultIntentColors,
73+
}
74+
75+
export const colors: Colors = {
76+
...specifiableColors,
77+
...fallbackBlends,
78+
...fallbackStateful,
79+
}

0 commit comments

Comments
 (0)