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

chore: dialog t-shirt sizing #3322

Merged
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
13 changes: 13 additions & 0 deletions .changeset/nasty-pillows-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@spectrum-css/dialog": patch
---

Dialog t-shirt sizes

Adds support for t-shirt sizing class names to dialog CSS. `@deprecated` comments were added to communicate that the old class names (`--small`, `--medium`, and `--large`) will be removed in S2.

| old class name | new class name |
| ----------------------- | ------------------------------------------------------ |
| spectrum-Dialog--small | spectrum-Dialog--sizeS |
| spectrum-Dialog--medium | spectrum-Dialog (the default, so no size is necessary) |
| spectrum-Dialog--large | spectrum-Dialog--sizeL |
16 changes: 9 additions & 7 deletions components/dialog/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@
--spectrum-dialog-confirm-divider-height: var(--spectrum-spacing-50);
}

.spectrum-Dialog {
/* @deprecated .spectrum-Dialog--medium */
.spectrum-Dialog,
.spectrum-Dialog--medium {
/* Be a flexbox to allow a full sized content area that scrolls */
display: flex;

/* Allow 100% width, taking into account padding */
box-sizing: border-box;

/* Be no bigger than max-width, but also be 90% if the viewport is smaller than max-width */
inline-size: fit-content;
/* Be no bigger than max-width, but also be 90% if the viewport is smaller than max-width */
inline-size: var(--mod-dialog-confirm-medium-width, var(--spectrum-dialog-confirm-medium-width));
Copy link
Collaborator Author

@marissahuysentruyt marissahuysentruyt Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this property to match the .spectrum-Dialog--medium definition. There are no --sizeM specific styles in S2- medium is the default so all of the "medium" styles are just under .spectrum-Dialog.

Does that change make sense to do here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine since .spectrum-Dialog--medium is getting deprecated anyway, but since .spectrum-Dialog and .spectrum--medium would, in theory, have all the same styles, is there a good reason to keep the .spectrum--medium selector in a section by itself? What are your thoughts on moving it up and combining it with the .spectrum-Dialog selector? So until it's deprecated, the selector would be

.spectrum-Dialog,
.spectrum-Dialog--medium {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I like that much better.

min-inline-size: var(--mod-dialog-min-inline-size, var(--spectrum-dialog-min-inline-size));
max-inline-size: 100%;

Expand All @@ -53,14 +55,14 @@
outline: none;
}

/* @deprecated .spectrum-Dialog--small */
.spectrum-Dialog--sizeS,
.spectrum-Dialog--small {
inline-size: var(--mod-dialog-confirm-small-width, var(--spectrum-dialog-confirm-small-width));
}

.spectrum-Dialog--medium {
inline-size: var(--mod-dialog-confirm-medium-width, var(--spectrum-dialog-confirm-medium-width));
}

/* @deprecated .spectrum-Dialog--large */
.spectrum-Dialog--sizeL,
.spectrum-Dialog--large {
inline-size: var(--mod-dialog-confirm-large-width, var(--spectrum-dialog-confirm-large-width));
}
Expand Down
2 changes: 2 additions & 0 deletions components/dialog/metadata/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
".spectrum-Dialog--medium",
".spectrum-Dialog--noDivider .spectrum-Dialog-divider",
".spectrum-Dialog--noDivider .spectrum-Dialog-heading",
".spectrum-Dialog--sizeL",
".spectrum-Dialog--sizeS",
".spectrum-Dialog--small",
".spectrum-Dialog-buttonGroup",
".spectrum-Dialog-buttonGroup.spectrum-Dialog-buttonGroup--noFooter",
Expand Down
Loading