Skip to content

Commit 1f45247

Browse files
committed
chore: remove all colors.background and colors.foreground theme references in prep for v9 (#1756)
1 parent d1fbad8 commit 1f45247

File tree

62 files changed

+136
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+136
-110
lines changed

.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const parameters = {
3232

3333
const GlobalPreviewStyling = createGlobalStyle`
3434
body {
35-
background-color: ${p => p.theme.colors.background};
35+
background-color: ${p => getColorV8('background', 600 /* default shade */, p.theme)};
3636
/* stylelint-disable-next-line declaration-no-important */
3737
padding: 0 !important;
3838
font-family: ${p => p.theme.fonts.system};

packages/.template/src/styled/Styled{{capitalize component}}.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface IStyled{{capitalize component}}Props extends ThemeProps<Default
1717
const colorStyles = (props: IStyled{{capitalize component}}Props) => {
1818
const backgroundColor = getColorV8('primaryHue', 600, props.theme, 0.08);
1919
const borderColor = getColorV8('primaryHue', 600, props.theme);
20-
const foregroundColor = props.theme.colors.foreground;
20+
const foregroundColor = getColorV8('foreground', 600 /* default shade */, props.theme);
2121
const hoverBackgroundColor = getColorV8('primaryHue', 600, props.theme, 0.2);
2222
const focusBoxShadow = props.theme.shadows.md(
2323
getColorV8('primaryHue', 600, props.theme, 0.35) as string

packages/accordions/src/styled/accordion/StyledButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface IStyledButton {
2424

2525
const colorStyles = (props: ThemeProps<DefaultTheme> & IStyledButton) => {
2626
const showColor = props.isCollapsible || !props.isExpanded;
27-
let color = props.theme.colors.foreground;
27+
let color = getColorV8('foreground', 600 /* default shade */, props.theme);
2828

2929
if (showColor && props.isHovered) {
3030
color = getColorV8('primaryHue', 600, props.theme)!;

packages/accordions/src/styled/stepper/StyledIcon.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import React from 'react';
99
import { render } from 'garden-test-utils';
1010
import { StyledIcon } from './StyledIcon';
11-
import { getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
11+
import { getColorV8, DEFAULT_THEME, PALETTE } from '@zendeskgarden/react-theming';
1212

1313
describe('StyledIcon', () => {
1414
it('renders default styles', () => {
1515
const { container } = render(<StyledIcon />);
1616

17-
expect(container.firstChild).toHaveStyleRule('color', DEFAULT_THEME.colors.foreground);
17+
expect(container.firstChild).toHaveStyleRule('color', PALETTE.grey[800]);
1818
expect(container.firstChild).toHaveStyleRule(
1919
'background',
2020
getColorV8('neutralHue', 200, DEFAULT_THEME)
@@ -25,7 +25,7 @@ describe('StyledIcon', () => {
2525
it('renders active color styles', () => {
2626
const { container } = render(<StyledIcon isActive />);
2727

28-
expect(container.firstChild).toHaveStyleRule('color', DEFAULT_THEME.colors.background);
28+
expect(container.firstChild).toHaveStyleRule('color', PALETTE.white);
2929
expect(container.firstChild).toHaveStyleRule(
3030
'background',
3131
getColorV8('neutralHue', 600, DEFAULT_THEME)

packages/accordions/src/styled/stepper/StyledIcon.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ const colorStyles = (props: IStyledIcon & ThemeProps<DefaultTheme>) => {
5151
background: ${props.isActive
5252
? getColorV8('neutralHue', 600, props.theme)
5353
: getColorV8('neutralHue', 200, props.theme)};
54-
color: ${props.isActive ? props.theme.colors.background : props.theme.colors.foreground};
54+
color: ${props.isActive
55+
? getColorV8('background', 600 /* default shade */, props.theme)
56+
: getColorV8('foreground', 600 /* default shade */, props.theme)};
5557
`;
5658
};
5759

packages/accordions/src/styled/stepper/StyledInnerContent.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import styled, { ThemeProps, DefaultTheme } from 'styled-components';
99
import {
1010
getLineHeight,
1111
retrieveComponentStyles,
12-
DEFAULT_THEME
12+
DEFAULT_THEME,
13+
getColorV8
1314
} from '@zendeskgarden/react-theming';
1415

1516
const COMPONENT_ID = 'accordions.step_inner_content';
@@ -20,7 +21,7 @@ export const StyledInnerContent = styled.div.attrs<ThemeProps<DefaultTheme>>({
2021
})`
2122
overflow: hidden;
2223
line-height: ${props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md)};
23-
color: ${props => props.theme.colors.foreground};
24+
color: ${props => getColorV8('foreground', 600 /* default shade */, props.theme)};
2425
font-size: ${props => props.theme.fontSizes.md};
2526
2627
${props => retrieveComponentStyles(COMPONENT_ID, props)};

packages/accordions/src/styled/stepper/StyledLabel.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import React from 'react';
99
import { render } from 'garden-test-utils';
1010
import { StyledLabel } from './StyledLabel';
11-
import { getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
11+
import { getColorV8, DEFAULT_THEME, PALETTE } from '@zendeskgarden/react-theming';
1212

1313
describe('StyledLabel', () => {
1414
it('renders default styles', () => {
@@ -36,7 +36,7 @@ describe('StyledLabel', () => {
3636
it('renders styles for active label', () => {
3737
const { container } = render(<StyledLabel isActive />);
3838

39-
expect(container.firstChild).toHaveStyleRule('color', DEFAULT_THEME.colors.foreground);
39+
expect(container.firstChild).toHaveStyleRule('color', PALETTE.grey[800]);
4040
expect(container.firstChild).toHaveStyleRule('font-weight', '600');
4141
});
4242
});

packages/accordions/src/styled/stepper/StyledLabel.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export const StyledLabel = styled.div.attrs<IStyledLabelProps>({
3232
text-align: ${props => props.isHorizontal && 'center'};
3333
line-height: ${props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md)};
3434
color: ${props =>
35-
props.isActive ? props.theme.colors.foreground : getColorV8('neutralHue', 600, props.theme)};
35+
props.isActive
36+
? getColorV8('foreground', 600 /* default shade */, props.theme)
37+
: getColorV8('neutralHue', 600, props.theme)};
3638
font-size: ${props => props.theme.fontSizes.md};
3739
font-weight: ${props => props.isActive && 600};
3840

packages/accordions/src/styled/timeline/StyledItem.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import styled, { css } from 'styled-components';
99
import {
1010
getLineHeight,
1111
retrieveComponentStyles,
12-
DEFAULT_THEME
12+
DEFAULT_THEME,
13+
getColorV8
1314
} from '@zendeskgarden/react-theming';
1415
import { StyledSeparator } from './StyledSeparator';
1516
import { StyledTimelineContent } from './StyledContent';
@@ -30,7 +31,7 @@ export const StyledTimelineItem = styled.li.attrs({
3031
display: flex;
3132
position: relative;
3233
line-height: ${props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md)};
33-
color: ${props => props.theme.colors.foreground};
34+
color: ${props => getColorV8('foreground', 600 /* default shade */, props.theme)};
3435
font-size: ${props => props.theme.fontSizes.md};
3536
3637
&:last-of-type ${StyledSeparator}::after {

packages/accordions/src/styled/timeline/StyledItemIcon.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export const StyledItemIcon = styled(({ surfaceColor, children, ...props }) =>
2828
})<IStyledItemIcon>`
2929
z-index: 1;
3030
box-sizing: content-box;
31-
background-color: ${props => props.surfaceColor || props.theme.colors.background};
31+
background-color: ${props =>
32+
props.surfaceColor || getColorV8('background', 600 /* default shade */, props.theme)};
3233
padding: ${props => props.theme.space.base}px 0;
3334
width: ${props => math(`${props.theme.iconSizes.sm} + 1`)}; /* [1] */
3435
height: ${props => math(`${props.theme.iconSizes.sm} + 1`)}; /* [1] */

0 commit comments

Comments
 (0)