Skip to content

Commit 07eb44e

Browse files
authored
feat(alertbanner): use width token for max-width instead of width (#2762)
The alert banner now occupies all available space until it reaches the maximum allowed width. By default it will no longer cut off in viewports smaller than the width token. The token --spectrum-alert-banner-width was previously used as the width, as it was shown in the design specs. Per a discussion with design, this had been intended as a max-width, to prevent having alert banners that are too wide and hard to read.
1 parent eefb19e commit 07eb44e

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.changeset/brave-seas-retire.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@spectrum-css/alertbanner": minor
3+
---
4+
5+
The alert banner component now occupies all available space until it reaches the maximum allowed width.
6+
The token previously used for the fixed width, `--spectrum-alert-banner-width`, is now used for the maximum width.
7+
This includes the additional of a new mod custom property: `--mod-alert-banner-max-inline-size`

components/alertbanner/index.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ governing permissions and limitations under the License.
1313

1414
.spectrum-AlertBanner {
1515
--spectrum-alert-banner-min-height: var(--spectrum-alert-banner-minimum-height);
16-
--spectrum-alert-banner-size: var(--spectrum-alert-banner-width);
16+
--spectrum-alert-banner-max-inline-size: var(--spectrum-alert-banner-width);
17+
--spectrum-alert-banner-size: auto;
1718
--spectrum-alert-banner-font-size: var(--spectrum-font-size-100);
1819
--spectrum-alert-banner-icon-size: var(--spectrum-workflow-icon-size-100);
1920

@@ -52,6 +53,7 @@ governing permissions and limitations under the License.
5253
display: none;
5354
justify-content: space-between;
5455
inline-size: var(--mod-alert-banner-size, var(--spectrum-alert-banner-size));
56+
max-inline-size: var(--mod-alert-banner-max-inline-size, var(--spectrum-alert-banner-max-inline-size));
5557
min-block-size: var(--mod-alert-banner-min-height, var(--spectrum-alert-banner-min-height));
5658
font-size: var(--mod-alert-banner-font-size, var(--spectrum-alert-banner-font-size));
5759
color: var(--mod-alert-banner-font-color, var(--spectrum-alert-banner-font-color));

components/alertbanner/metadata/mods.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| `--mod-alert-banner-icon-size` |
1010
| `--mod-alert-banner-icon-to-text` |
1111
| `--mod-alert-banner-informative-background` |
12+
| `--mod-alert-banner-max-inline-size` |
1213
| `--mod-alert-banner-min-height` |
1314
| `--mod-alert-banner-negative-background` |
1415
| `--mod-alert-banner-netural-background` |

0 commit comments

Comments
 (0)