Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(web): Switch Item component to v3 design tokens #DS-1451 #1648

Merged
merged 2 commits into from
Sep 19, 2024
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
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);
crishpeen marked this conversation as resolved.
Show resolved Hide resolved
$icon-color-disabled: var(--#{globals.$prefix}color-disabled-content);
2 changes: 2 additions & 0 deletions packages/web/src/scss/components/Radio/_Radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ $_field-name: 'Radio';

:is(.Radio--disabled, .Radio.is-disabled) > .Radio__input,
.Radio > .Radio__input:disabled {
@include form-fields-tools.input-disabled();

border-color: form-fields-theme.$input-border-color-disabled;
background-color: form-fields-theme.$input-background-color-disabled;

Expand Down
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
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;
crishpeen marked this conversation as resolved.
Show resolved Hide resolved
}

@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 @@ -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.
Loading