Skip to content

Commit

Permalink
fix(new-hope): add new tokens to combobox
Browse files Browse the repository at this point in the history
  • Loading branch information
iljs authored and Yakutoc committed Dec 4, 2024
1 parent 4dba484 commit b0ca153
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Ul = styled.ul<{

export const IconArrowWrapper = styled.div<{ disabled: boolean }>`
line-height: 0;
color: var(${constants.disclosureIconColor});
color: var(${tokens.disclosureIconColor}, var(${constants.disclosureIconColor}));
cursor: ${({ disabled }) => (disabled ? 'inherit' : 'pointer')};
.${classes.arrowInverse} {
Expand All @@ -48,7 +48,9 @@ export const IconArrowWrapper = styled.div<{ disabled: boolean }>`
&:hover,
&:active {
color: ${({ disabled }) =>
disabled ? `var(${constants.disclosureIconColor})` : `var(${constants.disclosureIconColorHover})`};
disabled
? `var(${tokens.disclosureIconColor}, var(${constants.disclosureIconColor}))`
: `var(${tokens.disclosureIconColorHover}, var(${constants.disclosureIconColorHover}))`};
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const tokens = {
itemIconSize: '--plasma-combobox-item-icon-size',
itemIconSizeTight: '--plasma-combobox-item-icon-size-tight',
itemIconMargin: '--plasma-combobox-item-icon-margin',
itemBackground: '--plasma-combobox-item-background',
itemBackgroundHover: '--plasma-combobox-item-background-hover',

cellPadding: '--plasma-combobox-cell-padding',
cellPaddingLeftContent: '--plasma-combobox-cell-padding-left-content',
Expand Down Expand Up @@ -160,6 +162,9 @@ export const tokens = {

spinnerSize: '--plasma-combobox-spinner-size',
spinnerSizeTight: '--plasma-combobox-spinner-size-tight',

disclosureIconColor: '--plasma-combobox-disclosure-icon-color',
disclosureIconColorHover: '--plasma-combobox-disclosure-icon-color-hover',
};

export const constants = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export const StyledContentRight = styled.div`

export const DisclosureIconWrapper = styled.div`
line-height: 0;
color: var(${constants.disclosureIconColor});
color: var(${tokens.disclosureIconColor}, var(${constants.disclosureIconColor}));
&:hover {
color: var(${constants.disclosureIconColorHover});
color: var(${tokens.disclosureIconColorHover}, var(${constants.disclosureIconColorHover}));
}
`;

Expand Down Expand Up @@ -98,7 +98,7 @@ export const Wrapper = styled.li<{ variant: ComboboxProps['variant'] }>`
font-weight: var(${tokens.fontWeight});
letter-spacing: var(${tokens.fontLetterSpacing});
line-height: var(${tokens.fontLineHeight});
background-color: var(${constants.itemBackground});
background-color: var(${tokens.itemBackground}, var(${constants.itemBackground}));
color: var(--text-primary);
border-radius: var(${tokens.borderRadius});
user-select: none;
Expand All @@ -108,11 +108,11 @@ export const Wrapper = styled.li<{ variant: ComboboxProps['variant'] }>`
&:hover:not(.${classes.dropdownItemIsDisabled}) {
cursor: pointer;
background-color: var(${constants.itemBackgroundHover});
background-color: var(${tokens.itemBackgroundHover}, var(${constants.itemBackgroundHover}));
}
&.${classes.dropdownItemIsActive} {
background-color: var(${constants.itemBackgroundHover});
background-color: var(${tokens.itemBackgroundHover}, var(${constants.itemBackgroundHover}));
}
&.${classes.dropdownItemIsDisabled} {
Expand Down
3 changes: 3 additions & 0 deletions packages/sdds-cs/src/components/Combobox/Combobox.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export const config = {
${tokens.textFieldChipColorReadOnlyHover}: var(--text-primary);
${tokens.textFieldChipOpacityReadonly}: 0.72;
${tokens.dropdownBorderColor}: var(--surface-solid-primary);
${tokens.disclosureIconColor}: var(--text-accent);
${tokens.disclosureIconColorHover}: var(--text-accent-hover);
${tokens.itemBackgroundHover}: var(--surface-transparent-accent);
`,
},
size: {
Expand Down

0 comments on commit b0ca153

Please sign in to comment.