-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat(banner): add x for closing
#9008
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| @reference "../../styles/index.css"; | ||
|
|
||
| .banner { | ||
| @apply flex | ||
| @apply relative | ||
| flex | ||
| w-full | ||
| flex-row | ||
| items-center | ||
|
|
@@ -40,3 +41,15 @@ | |
| .warning { | ||
| @apply bg-warning-600; | ||
| } | ||
|
|
||
| .closeButton { | ||
| @apply absolute | ||
| right-4 | ||
| text-lg; | ||
|
|
||
| span { | ||
| @apply text-white/60 | ||
| transition-colors | ||
| hover:text-white; | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Close button overlaps contentMedium Severity The close control is Additional Locations (1)Reviewed by Cursor Bugbot for commit bd140ea. Configure here. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,40 @@ | ||
| import type { FC, HTMLAttributes, PropsWithChildren } from 'react'; | ||
| import classNames from 'classnames'; | ||
|
|
||
| import type { | ||
| FC, | ||
| HTMLAttributes, | ||
| MouseEventHandler, | ||
| PropsWithChildren, | ||
| } from 'react'; | ||
|
|
||
| import styles from './index.module.css'; | ||
|
|
||
| export type BannerProps = { | ||
| type?: 'default' | 'warning' | 'error'; | ||
| onClose?: MouseEventHandler<HTMLButtonElement>; | ||
| } & HTMLAttributes<HTMLElement>; | ||
|
|
||
| const Banner: FC<PropsWithChildren<BannerProps>> = ({ | ||
| type = 'default', | ||
| onClose, | ||
| children, | ||
| ...props | ||
| }) => ( | ||
| <section | ||
| className={`${styles.banner} ${styles[type] || styles.default}`} | ||
| className={classNames(styles.banner, styles[type] || styles.default)} | ||
| {...props} | ||
| > | ||
| {children} | ||
| {onClose && ( | ||
| <button | ||
| type="button" | ||
| className={styles.closeButton} | ||
| aria-label="Close banner" | ||
| onClick={onClose} | ||
| > | ||
| <span aria-hidden="true">×</span> | ||
| </button> | ||
|
MattIPv4 marked this conversation as resolved.
cursor[bot] marked this conversation as resolved.
|
||
| )} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Close label not localizableLow Severity The close control hardcodes Reviewed by Cursor Bugbot for commit b2dc64f. Configure here. |
||
| </section> | ||
| ); | ||
|
|
||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.