Skip to content

Commit

Permalink
Feat(web): Switch Item component to v3 design tokens #DS-1451
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen committed Sep 19, 2024
1 parent 70fab2b commit cede577
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 13 deletions.
6 changes: 1 addition & 5 deletions packages/web/src/scss/components/Item/_Item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

.Item__label {
@include form-fields.inline-field-label();
@include form-fields.item-label();

grid-column: 2;
}
Expand Down Expand Up @@ -60,10 +60,6 @@
margin-inline-start: theme.$gap;
}

.Item--selected .Item__label {
@include form-fields.item-label-checked();
}

.Item--disabled {
@include form-fields.item-disabled();

Expand Down
9 changes: 5 additions & 4 deletions packages/web/src/scss/components/Item/_theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use '@tokens' as tokens;
@use '@global' as global-tokens;
@use '../../settings/globals';

$gap: tokens.$space-400;
$icon-color-default: tokens.$action-selected-default;
$icon-color-disabled: tokens.$action-selected-disabled;
$gap: global-tokens.$space-500;
$icon-color-default: var(--#{globals.$prefix}color-selected-content-basic);
$icon-color-disabled: var(--#{globals.$prefix}color-disabled-content);
2 changes: 1 addition & 1 deletion packages/web/src/scss/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@forward 'Grid';

// @forward 'Header';
// @forward 'Item';
@forward 'Item';
@forward 'Modal';
@forward 'Pagination';
@forward 'PartnerLogo';
Expand Down
4 changes: 3 additions & 1 deletion packages/web/src/scss/theme/_form-fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ $validation-states: (
);

// Item variant
$item-gap: global-tokens.$space-500;
$item-padding-x: global-tokens.$space-700;
$item-padding-y: global-tokens.$space-500;
$item-border-radius: global-tokens.$radius-200;
$item-background-color-default: var(--#{globals.$prefix}color-background-interactive-default);
$item-background-color-hover: var(--#{globals.$prefix}color-background-interactive-hover);
$item-background-color-active: var(--#{globals.$prefix}color-background-interactive-active);
$item-label-typography: global-tokens.$body-medium-semibold;
$item-validation-text-typography: global-tokens.$body-small-semibold;
$item-helper-text-typography: global-tokens.$body-small-regular;
$item-helper-text-margin-top: global-tokens.$space-300;
7 changes: 6 additions & 1 deletion packages/web/src/scss/tools/_form-fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@
}

@mixin item() {
align-items: center;
width: 100%;
padding: form-fields-theme.$item-gap;
padding: form-fields-theme.$item-padding-y form-fields-theme.$item-padding-x;
margin-block: 0;
border-radius: form-fields-theme.$item-border-radius;
background-color: form-fields-theme.$item-background-color-default;
Expand All @@ -232,6 +233,8 @@

@mixin item-label() {
@include typography.generate(form-fields-theme.$item-label-typography);

color: form-fields-theme.$label-color-default;
}

@mixin helper-text() {
Expand All @@ -248,4 +251,6 @@

@mixin item-helper-text() {
@include typography.generate(form-fields-theme.$item-helper-text-typography);

margin-top: form-fields-theme.$item-helper-text-margin-top;
}
1 change: 0 additions & 1 deletion tests/e2e/demo-components-compare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const IGNORED_TESTS: string[] = [
'FileUploader',
'Header',
'Icon',
'Item',
'Spinner',
'Stack',
'Toast',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cede577

Please sign in to comment.