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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const StyledColorSwatchInput = styled.input.attrs({
opacity: 0;
z-index: 1;
margin: 0;
cursor: pointer;
width: 100%;
height: 100%;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import styled, { DefaultTheme, ThemeProps } from 'styled-components';
import { parseToRgb, readableColor } from 'polished';
import { DEFAULT_THEME, getColor, retrieveComponentStyles } from '@zendeskgarden/react-theming';
import { DEFAULT_THEME, focusStyles, retrieveComponentStyles } from '@zendeskgarden/react-theming';
import { StyledButtonPreview } from '../ColorPickerDialog/StyledButtonPreview';
import { IRGBColor } from '../../types';

Expand All @@ -18,7 +18,6 @@ interface IStyledColorSwatchLabelProps extends ThemeProps<DefaultTheme> {
}

const colorStyles = (props: IStyledColorSwatchLabelProps) => {
const boxShadow = props.theme.shadows.md(getColor('primaryHue', 600, props.theme, 0.35)!);
const { alpha } = parseToRgb(props.backgroundColor) as IRGBColor;
let foregroundColor;

Expand All @@ -34,9 +33,6 @@ const colorStyles = (props: IStyledColorSwatchLabelProps) => {

return `
color: ${foregroundColor};

&[data-garden-focus-visible] {
box-shadow: ${boxShadow};
`;
};

Expand All @@ -46,11 +42,13 @@ export const StyledColorSwatchLabel = styled(StyledButtonPreview).attrs({
'data-garden-version': PACKAGE_VERSION
})`
position: relative;
top: 0;
border-radius: ${props => props.theme.borderRadii.md};
cursor: pointer;

${colorStyles};

${props => focusStyles({ theme: props.theme, selector: '&:has(:focus-visible)' })}

${props => retrieveComponentStyles(COMPONENT_ID, props)};
`;

Expand Down