Skip to content

Commit

Permalink
feat(plasma-*, sdds-*): Switch track border tokens improved
Browse files Browse the repository at this point in the history
  • Loading branch information
denivladislav committed Nov 18, 2024
1 parent 3e5bfda commit d1a202a
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-main-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-secondary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-secondary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
1 change: 0 additions & 1 deletion packages/plasma-b2c/src/components/Switch/Switch.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const tokens = {
verticalGap: '--plasma-switch-vertical-gap',
trackWidth: '--plasma-switch__track-width',
trackHeight: '--plasma-switch__track-height',
trackBorderWidth: '--plasma-switch__track-border',
trackBorderWidthOn: '--plasma-switch__track-checked_true-border-width',
trackBorderWidthOff: '--plasma-switch__track-checked_false-border-width',
trackBorderColorOn: '--plasma-switch__track-checked_true-border-color',
trackBorderColorOnHover: '--plasma-switch__track-checked_true_hovered_true-border-color',
trackBorderColorOff: '--plasma-switch__track-checked_false-border-color',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { css } from '@linaria/core';

import { tokens } from '../Switch.tokens';
import { StyledTrigger } from '../Switch.styles';
import { StyledInput, StyledTrigger } from '../Switch.styles';

export const base = css`
${StyledTrigger} {
box-sizing: border-box;
flex: 0 0 var(${tokens.trackWidth});
border-style: solid;
border-width: var(${tokens.trackBorderWidth});
border-width: var(${tokens.trackBorderWidthOff});
border-radius: var(${tokens.trackBorderRadius});
width: var(${tokens.trackWidth});
Expand All @@ -23,6 +23,10 @@ export const base = css`
}
}
${StyledInput}:checked ~ ${StyledTrigger} {
border-width: var(${tokens.trackBorderWidthOn}, var(${tokens.trackBorderWidthOff}));
}
:active:not([disabled]) ${StyledTrigger}::after {
width: calc(var(${tokens.thumbSize}) * var(${tokens.thumbPressScale}, 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export const config = {
default: css`
${switchTokens.labelColor}: var(--text-primary);
${switchTokens.descriptionColor}: var(--text-secondary);
${switchTokens.trackBorderWidth}: 0.0625rem;
${switchTokens.trackBorderWidthOn}: 0.0625rem;
${switchTokens.trackBorderWidthOff}: 0.0625rem;
${switchTokens.trackBorderColorOff}: var(--outline-secondary);
${switchTokens.trackBorderColorOffHover}: var(--outline-secondary-hover);
${switchTokens.trackBorderColorOn}: var(--outline-accent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export const config = {
default: css`
${switchTokens.labelColor}: var(--text-primary);
${switchTokens.descriptionColor}: var(--text-secondary);
${switchTokens.trackBorderWidth}: 0.0625rem;
${switchTokens.trackBorderWidthOn}: 0.0625rem;
${switchTokens.trackBorderWidthOff}: 0.0625rem;
${switchTokens.trackBorderColorOff}: var(--outline-secondary);
${switchTokens.trackBorderColorOffHover}: var(--outline-secondary-hover);
${switchTokens.trackBorderColorOn}: var(--outline-accent);
Expand Down
1 change: 0 additions & 1 deletion packages/plasma-web/src/components/Switch/Switch.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
1 change: 0 additions & 1 deletion packages/sdds-dfa/src/components/Switch/Switch.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
1 change: 0 additions & 1 deletion packages/sdds-insol/src/components/Switch/Switch.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down
1 change: 0 additions & 1 deletion packages/sdds-serv/src/components/Switch/Switch.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export const config = {
${switchTokens.trackBackgroundColorOnHover}: var(--surface-accent-hover);
${switchTokens.trackBackgroundColorOff}: var(--surface-transparent-tertiary);
${switchTokens.trackBackgroundColorOffHover}: var(--surface-transparent-tertiary-hover);
${switchTokens.trackBorderWidth}: 0rem;
${switchTokens.thumbBackgroundColorOff}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBackgroundColorOn}: var(--on-dark-surface-solid-default);
${switchTokens.thumbBoxShadow}: 0 1px 1px rgba(0, 0, 0, 0.11);
Expand Down

0 comments on commit d1a202a

Please sign in to comment.