Skip to content

Commit f23e081

Browse files
author
Zack Jones
committed
feat(headline): migrate to semantic colors
1 parent a47e1a7 commit f23e081

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.storybook/preview.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { Preview } from '@storybook/react';
33
import { themes } from '@storybook/theming';
44
import { ClassicColors, ModernColors } from '../src/essentials/Colors/globalStyles';
5+
import { getSemanticValue } from '../src/utils/cssVariables';
56

67
const THEMES = {
78
classic: ClassicColors,
@@ -41,8 +42,8 @@ export const preview: Preview = {
4142
backgrounds: {
4243
default: 'light',
4344
values: [
44-
{ name: 'light', value: '#FFFFFF' },
45-
{ name: 'dark', value: '#001E3E' }
45+
{ name: 'light', value: getSemanticValue('background-primary-default') },
46+
{ name: 'dark', value: getSemanticValue('background-primary-inverted') }
4647
]
4748
},
4849
viewport: {

docs/components/ItemWrapper.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from 'styled-components';
22
import { compose, margin, MarginProps, padding, PaddingProps } from 'styled-system';
3-
import { Colors, Spaces } from '../../src/essentials';
3+
import { Spaces } from '../../src/essentials';
4+
import { getSemanticValue } from '../../src/utils/cssVariables';
45

56
type ItemWrapperProps = PaddingProps &
67
MarginProps & {
@@ -17,7 +18,7 @@ const ItemWrapper = styled.div<ItemWrapperProps>`
1718
grid-template-columns: ${p => (p.gridTemplate ? p.gridTemplate : '1fr')};
1819
grid-row-gap: ${Spaces[3]};
1920
grid-column-gap: ${Spaces[2]};
20-
background-color: ${p => (p.inverted ? Colors.AUTHENTIC_BLUE_900 : Colors.WHITE)};
21+
background-color: ${p => getSemanticValue(p.inverted ? 'background-primary-inverted' : 'background-primary-default')};
2122
2223
${compose(padding, margin)}
2324
`;

src/components/Headline/Headline.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import * as React from 'react';
22
import { ComponentPropsWithoutRef } from 'react';
33
import styled from 'styled-components';
44
import { compose, margin, system, MarginProps, textAlign, TextAlignProps, ResponsiveValue } from 'styled-system';
5-
import { Colors } from '../../essentials';
65
import { theme } from '../../essentials/theme';
76
import { get } from '../../utils/themeGet';
7+
import { getSemanticValue } from '../../utils/cssVariables';
88

99
interface HeadlineProps extends ComponentPropsWithoutRef<'h1'>, MarginProps, TextAlignProps {
1010
/**
@@ -59,7 +59,7 @@ const getSize = ({ as = 'h1', size }: HeadlineProps): ResponsiveValue<'xxl' | 'x
5959
size || DEFAULT_HEADLINE_SIZE[as];
6060

6161
const Headline: React.FC<HeadlineProps> = styled.h1.attrs({ theme })<HeadlineProps>`
62-
color: ${p => (p.inverted ? Colors.WHITE : Colors.AUTHENTIC_BLUE_900)};
62+
color: ${p => getSemanticValue(p.inverted ? 'text-primaryInverted' : 'text-primary')};
6363
font-family: ${get('fonts.normal')};
6464
font-weight: ${get('fontWeights.bold')};
6565
margin: 0;

0 commit comments

Comments
 (0)