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 28c0ebd commit 7e531b9
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 14 deletions.
10 changes: 4 additions & 6 deletions packages/web/src/scss/components/Item/_Item.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// 1. Make the icon span two rows to spread over the whole Item vertically and make it centered.

@use 'sass:map';
@use 'theme';
@use '../../settings/cursors';
Expand Down Expand Up @@ -31,7 +33,7 @@
}

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

grid-column: 2;
}
Expand All @@ -46,7 +48,7 @@

.Item__icon {
display: flex;
grid-row: 1;
grid-row: span 2; // 1.
color: theme.$icon-color-default;
}

Expand All @@ -60,10 +62,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 @@ -14,7 +14,7 @@
@forward 'Grid';

// @forward 'Header';
// @forward 'Item';
@forward 'Item';
@forward 'Modal';
@forward 'Pagination';
@forward 'PartnerLogo';
Expand Down
3 changes: 2 additions & 1 deletion packages/web/src/scss/theme/_form-fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ $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);
Expand Down
5 changes: 4 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 Down
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 @@ -10,7 +10,6 @@ const IGNORED_TESTS: string[] = [
'Dropdown',
'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 7e531b9

Please sign in to comment.