Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const parameters = {

const GlobalPreviewStyling = createGlobalStyle`
body {
background-color: ${p => p.theme.colors.background};
background-color: ${p => getColorV8('background', 600 /* default shade */, p.theme)};
/* stylelint-disable-next-line declaration-no-important */
padding: 0 !important;
font-family: ${p => p.theme.fonts.system};
Expand Down
110 changes: 104 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/.template/src/styled/Styled{{capitalize component}}.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import styled, { ThemeProps, DefaultTheme, css } from 'styled-components';
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';

const COMPONENT_ID = '{{pluralize (lowercase component)}}.{{lowercase component}}';

Expand All @@ -15,12 +15,12 @@ export interface IStyled{{capitalize component}}Props extends ThemeProps<Default
}

const colorStyles = (props: IStyled{{capitalize component}}Props) => {
const backgroundColor = getColor('primaryHue', 600, props.theme, 0.08);
const borderColor = getColor('primaryHue', 600, props.theme);
const foregroundColor = props.theme.colors.foreground;
const hoverBackgroundColor = getColor('primaryHue', 600, props.theme, 0.2);
const backgroundColor = getColorV8('primaryHue', 600, props.theme, 0.08);
const borderColor = getColorV8('primaryHue', 600, props.theme);
const foregroundColor = getColorV8('foreground', 600 /* default shade */, props.theme);
const hoverBackgroundColor = getColorV8('primaryHue', 600, props.theme, 0.2);
const focusBoxShadow = props.theme.shadows.md(
getColor('primaryHue', 600, props.theme, 0.35) as string
getColorV8('primaryHue', 600, props.theme, 0.35) as string
);

return css`
Expand Down
2 changes: 1 addition & 1 deletion packages/accordions/src/styled/accordion/StyledButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface IStyledButton {

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

if (showColor && props.isHovered) {
color = getColorV8('primaryHue', 600, props.theme)!;
Expand Down
6 changes: 3 additions & 3 deletions packages/accordions/src/styled/stepper/StyledIcon.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import React from 'react';
import { render } from 'garden-test-utils';
import { StyledIcon } from './StyledIcon';
import { getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
import { getColorV8, DEFAULT_THEME, PALETTE } from '@zendeskgarden/react-theming';

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

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

expect(container.firstChild).toHaveStyleRule('color', DEFAULT_THEME.colors.background);
expect(container.firstChild).toHaveStyleRule('color', PALETTE.white);
expect(container.firstChild).toHaveStyleRule(
'background',
getColorV8('neutralHue', 600, DEFAULT_THEME)
Expand Down
4 changes: 3 additions & 1 deletion packages/accordions/src/styled/stepper/StyledIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ const colorStyles = (props: IStyledIcon & ThemeProps<DefaultTheme>) => {
background: ${props.isActive
? getColorV8('neutralHue', 600, props.theme)
: getColorV8('neutralHue', 200, props.theme)};
color: ${props.isActive ? props.theme.colors.background : props.theme.colors.foreground};
color: ${props.isActive
? getColorV8('background', 600 /* default shade */, props.theme)
: getColorV8('foreground', 600 /* default shade */, props.theme)};
`;
};

Expand Down
5 changes: 3 additions & 2 deletions packages/accordions/src/styled/stepper/StyledInnerContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import styled, { ThemeProps, DefaultTheme } from 'styled-components';
import {
getLineHeight,
retrieveComponentStyles,
DEFAULT_THEME
DEFAULT_THEME,
getColorV8
} from '@zendeskgarden/react-theming';

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

${props => retrieveComponentStyles(COMPONENT_ID, props)};
Expand Down
4 changes: 2 additions & 2 deletions packages/accordions/src/styled/stepper/StyledLabel.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { render } from 'garden-test-utils';
import { StyledLabel } from './StyledLabel';
import { getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
import { getColorV8, DEFAULT_THEME, PALETTE } from '@zendeskgarden/react-theming';

describe('StyledLabel', () => {
it('renders default styles', () => {
Expand Down Expand Up @@ -36,7 +36,7 @@ describe('StyledLabel', () => {
it('renders styles for active label', () => {
const { container } = render(<StyledLabel isActive />);

expect(container.firstChild).toHaveStyleRule('color', DEFAULT_THEME.colors.foreground);
expect(container.firstChild).toHaveStyleRule('color', PALETTE.grey[800]);
expect(container.firstChild).toHaveStyleRule('font-weight', '600');
});
});
4 changes: 3 additions & 1 deletion packages/accordions/src/styled/stepper/StyledLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export const StyledLabel = styled.div.attrs<IStyledLabelProps>({
text-align: ${props => props.isHorizontal && 'center'};
line-height: ${props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md)};
color: ${props =>
props.isActive ? props.theme.colors.foreground : getColorV8('neutralHue', 600, props.theme)};
props.isActive
? getColorV8('foreground', 600 /* default shade */, props.theme)
: getColorV8('neutralHue', 600, props.theme)};
font-size: ${props => props.theme.fontSizes.md};
font-weight: ${props => props.isActive && 600};

Expand Down
5 changes: 3 additions & 2 deletions packages/accordions/src/styled/timeline/StyledItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import styled, { css } from 'styled-components';
import {
getLineHeight,
retrieveComponentStyles,
DEFAULT_THEME
DEFAULT_THEME,
getColorV8
} from '@zendeskgarden/react-theming';
import { StyledSeparator } from './StyledSeparator';
import { StyledTimelineContent } from './StyledContent';
Expand All @@ -30,7 +31,7 @@ export const StyledTimelineItem = styled.li.attrs({
display: flex;
position: relative;
line-height: ${props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md)};
color: ${props => props.theme.colors.foreground};
color: ${props => getColorV8('foreground', 600 /* default shade */, props.theme)};
font-size: ${props => props.theme.fontSizes.md};

&:last-of-type ${StyledSeparator}::after {
Expand Down
3 changes: 2 additions & 1 deletion packages/accordions/src/styled/timeline/StyledItemIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const StyledItemIcon = styled(({ surfaceColor, children, ...props }) =>
})<IStyledItemIcon>`
z-index: 1;
box-sizing: content-box;
background-color: ${props => props.surfaceColor || props.theme.colors.background};
background-color: ${props =>
props.surfaceColor || getColorV8('background', 600 /* default shade */, props.theme)};
padding: ${props => props.theme.space.base}px 0;
width: ${props => math(`${props.theme.iconSizes.sm} + 1`)}; /* [1] */
height: ${props => math(`${props.theme.iconSizes.sm} + 1`)}; /* [1] */
Expand Down
4 changes: 2 additions & 2 deletions packages/avatars/src/styled/StyledAvatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import styled, { css, ThemeProps, keyframes, DefaultTheme } from 'styled-components';
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
import { math } from 'polished';

import { IAvatarProps, SIZE } from '../types';
Expand Down Expand Up @@ -57,7 +57,7 @@ const colorStyles = (props: IStyledAvatarProps & ThemeProps<DefaultTheme>) => {
const backgroundColor = props.backgroundColor || 'transparent';
const foregroundColor = props.foregroundColor || props.theme.palette.white;
const surfaceColor = props.status
? props.surfaceColor || props.theme.colors.background
? props.surfaceColor || getColorV8('background', 600 /* default shade */, props.theme)
: 'transparent';

return css`
Expand Down
7 changes: 5 additions & 2 deletions packages/avatars/src/styled/StyledStatusIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import styled, { css, ThemeProps, DefaultTheme } from 'styled-components';
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
import { math } from 'polished';

import { IAvatarProps, SIZE } from '../types';
Expand Down Expand Up @@ -64,7 +64,10 @@ const colorStyles = (props: IStatusIndicatorProps & ThemeProps<DefaultTheme>) =>
const { theme, type, size, borderColor, surfaceColor } = props;

let boxShadow = theme.shadows.sm(
surfaceColor || (type ? theme.colors.background : (theme.palette.white as string))
surfaceColor ||
(type
? getColorV8('background', 600 /* default shade */, theme)!
: (theme.palette.white as string))
);

if (size === xxs) {
Expand Down
4 changes: 3 additions & 1 deletion packages/buttons/src/styled/StyledButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ const colorStyles = (props: IButtonProps & ThemeProps<DefaultTheme>) => {
} else {
const borderColor =
props.isNeutral && !props.isDanger ? getColorV8('neutralHue', 300, props.theme) : baseColor;
const foregroundColor = props.isNeutral ? props.theme.colors.foreground : baseColor;
const foregroundColor = props.isNeutral
? getColorV8('foreground', 600 /* default shade */, props.theme)
: baseColor;
const hoverBorderColor = props.isNeutral && !props.isDanger ? baseColor : hoverColor;
const hoverForegroundColor = props.isNeutral ? foregroundColor : hoverColor;

Expand Down
Loading