Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/cold-papers-say.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

changed some CSS to improve the wrapping behavior of the banner component
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
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
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
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
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
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
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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions e2e/components/Banner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const stories: Array<{title: string; id: string; viewports?: Array<keyof typeof
id: 'components-banner-features--with-hidden-title',
},
{
title: 'WithHiddenTitleAndActions',
id: 'components-banner-features--with-hidden-title-and-actions',
title: 'WithHiddenTitleAndActionsLong',
id: 'components-banner-features--with-hidden-title-and-actions-long',
viewports: ['primer.breakpoint.xs', 'primer.breakpoint.sm'],
},
{
Expand All @@ -70,6 +70,11 @@ const stories: Array<{title: string; id: string; viewports?: Array<keyof typeof
id: 'components-banner-examples--multiline',
viewports: ['primer.breakpoint.xs', 'primer.breakpoint.sm'],
},
{
title: 'WithHiddenTitleAndActionsShort',
id: 'components-banner-features--with-hidden-title-and-actions-short',
viewports: ['primer.breakpoint.xs', 'primer.breakpoint.sm'],
},
]

test.describe('Banner', () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/Banner/Banner.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
"id": "components-banner-features--with-hidden-title"
},
{
"id": "components-banner-features--with-hidden-title-and-actions"
"id": "components-banner-features--with-hidden-title-and-actions-short"
},
{
"id": "components-banner-features--with-hidden-title-and-actions-long"
},
{
"id": "components-banner-features--dismissible-with-hidden-title-and-actions"
Expand Down
14 changes: 13 additions & 1 deletion packages/react/src/Banner/Banner.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const WithHiddenTitle = () => {
)
}

export const WithHiddenTitleAndActions = () => {
export const WithHiddenTitleAndActionsLong = () => {
return (
<Banner
title="Warning"
Expand Down Expand Up @@ -205,6 +205,18 @@ export const DismissibleWithHiddenTitleAndActions = () => {
)
}

export const WithHiddenTitleAndActionsShort = () => {
return (
<Banner
title="Warning"
hideTitle
description={<>A short message that does not wrap.</>}
variant="warning"
primaryAction={<Banner.PrimaryAction>Button</Banner.PrimaryAction>}
/>
)
}

export const DismissibleWithHiddenTitleAndSecondaryAction = () => {
return (
<Banner
Expand Down
30 changes: 16 additions & 14 deletions packages/react/src/Banner/Banner.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
}

.Banner[data-dismissible]:not([data-title-hidden='']) .BannerContainer {
Expand All @@ -75,18 +76,19 @@
.BannerContent {
display: grid;
row-gap: var(--base-size-4);
grid-column-start: 1;
margin-block: var(--base-size-8);
flex: 1 1 auto;
min-width: 0;
max-width: max-content;
}

.Banner[data-title-hidden]:not(:has(.BannerActions)) .BannerContent {
margin-block: var(--base-size-6);
}

@media screen and (min-width: 544px) {
.BannerContent {
flex: 1 1 0%;
}
.Banner :where(.BannerContainer) .BannerContent:has(.BannerTitle + *) {
max-width: none;
flex: 1 1 250px;
}

.BannerTitle {
Expand Down Expand Up @@ -142,10 +144,7 @@
column-gap: var(--base-size-12);
align-items: center;
margin-block: var(--base-size-2);
}

.BannerActions :where([data-primary-action='trailing']) {
display: none;
flex-shrink: 0;
}

@media screen and (--viewportRange-regular) {
Expand Down Expand Up @@ -174,13 +173,15 @@

/* Layout ------------------------------------------------------------------- */

@container banner (max-width: 500px) {
.BannerContainer {
@container banner (max-width: 499px) {
.BannerContainer:has(.BannerActionsContainer) {
display: grid;
grid-template-rows: auto auto;
}

.BannerContainer:has(.BannerActionsContainer) {
grid-template-rows: auto auto;
.BannerContainer:has(.BannerTitle):not(:has(.BannerTitle + *)):has(.BannerActionsContainer) {
display: flex;
flex-wrap: wrap;
}

.BannerActions {
Expand All @@ -196,10 +197,11 @@
}
}

@container banner (min-width: 500px) {
@container banner (min-width: 500.01px) {
.BannerContainer {
display: grid;
grid-template-columns: auto auto;
column-gap: var(--base-size-6);
}

:where(.Banner):not([data-dismissible])
Expand Down
Loading