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

Banner: Fix alignment of secondary action without primary action #5026

Merged
merged 4 commits into from
Sep 25, 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
5 changes: 5 additions & 0 deletions .changeset/flat-weeks-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Banner: Fix alignment of secondary action without primary action
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.
5 changes: 5 additions & 0 deletions e2e/components/Banner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ const stories: Array<{title: string; id: string; viewports?: Array<keyof typeof
id: 'experimental-components-banner-features--dismissible-with-hidden-title-and-actions',
viewports: ['primer.breakpoint.xs', 'primer.breakpoint.sm'],
},
{
title: 'DismissibleWithHiddenTitleAndSecondaryAction',
id: 'experimental-components-banner-features--dismissible-with-hidden-title-and-secondary-action',
viewports: ['primer.breakpoint.xs', 'primer.breakpoint.sm'],
},
{
title: 'InSidebar',
id: 'experimental-components-banner-examples--in-sidebar',
Expand Down
23 changes: 22 additions & 1 deletion packages/react/src/Banner/Banner.features.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {CopilotIcon} from '@primer/octicons-react'
import {CopilotIcon, GitPullRequestIcon} from '@primer/octicons-react'
import {action} from '@storybook/addon-actions'
import type {Meta} from '@storybook/react'
import {Banner} from '../Banner'
Expand Down Expand Up @@ -206,6 +206,27 @@ export const DismissibleWithHiddenTitleAndActions = () => {
)
}

export const DismissibleWithHiddenTitleAndSecondaryAction = () => {
return (
<Banner
title="Warning"
hideTitle
description={
<>
GitHub users are{' '}
<Link inline underline href="#">
now required
</Link>{' '}
to enable two-factor authentication as an additional security measure.
</>
}
onDismiss={action('onDismiss')}
variant="warning"
secondaryAction={<Banner.SecondaryAction leadingVisual={GitPullRequestIcon}>Button</Banner.SecondaryAction>}
/>
)
}

export const WithActions = () => {
return (
<Banner
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/Banner/Banner.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@

.BannerActions [data-primary-action='trailing'] {
display: flex;
min-height: var(--base-size-32, 2rem);
}

.BannerActions [data-primary-action='leading'] {
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ const BannerContainerQuery = `

.BannerActions [data-primary-action="trailing"] {
display: flex;
min-height: var(--base-size-32, 2rem);
}

.BannerActions [data-primary-action="leading"] {
Expand Down
Loading