Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
add data-component attributes for Avatar, AvatarStack, Banner, & BaseStyles#7734
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
4208dc0c8b5010fb17c9e61a6b1140788bb7c384fd2d12c52b0461be9152d48a7697fff506834f4c7cd4c2bf001359976d0d4323c81c4cf5ea37cc0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@primer/react": patch | ||
| --- | ||
| add data-component attributes for Avatar, AvatarStack, Banner, & BaseStyles |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -157,6 +157,7 @@ export const Banner = React.forwardRef<HTMLElement, BannerProps>(function Banner | ||
| return ( | ||
| <BannerContext.Provider value={{titleId}}> | ||
| <section | ||
| data-component="Banner" | ||
| {...rest} | ||
| aria-labelledby={labelledBy ?? (label ? undefined : titleId)} | ||
| aria-label={labelledBy ? undefined : label} | ||
| @@ -171,9 +172,11 @@ export const Banner = React.forwardRef<HTMLElement, BannerProps>(function Banner | ||
| data-layout={rest.layout || 'default'} | ||
| data-flush={flush ? '' : undefined} | ||
| > | ||
| <div className={classes.BannerIcon}>{visual && supportsCustomIcon ? visual : iconForVariant[variant]}</div> | ||
| <div data-component="Banner.Icon" className={classes.BannerIcon}> | ||
| {visual && supportsCustomIcon ? visual : iconForVariant[variant]} | ||
| </div> | ||
| <div className={classes.BannerContainer}> | ||
| <div className={classes.BannerContent}> | ||
| <div data-component="Banner.Content" className={classes.BannerContent}> | ||
| {title ? ( | ||
| hideTitle ? ( | ||
| <VisuallyHidden> | ||
| @@ -215,7 +218,13 @@ export function BannerTitle<As extends HeadingElement>(props: BannerTitleProps<A | ||
| const titleId = id ?? context?.titleId | ||
| return ( | ||
| <Heading {...rest} id={titleId} className={clsx(className, classes.BannerTitle)} data-banner-title=""> | ||
| <Heading | ||
| {...rest} | ||
| id={titleId} | ||
| className={clsx(className, classes.BannerTitle)} | ||
| data-component="Banner.Title" | ||
| data-banner-title="" | ||
| > | ||
| {children} | ||
| </Heading> | ||
| ) | ||
| @@ -225,7 +234,7 @@ export type BannerDescriptionProps = React.ComponentPropsWithoutRef<'div'> | ||
| export function BannerDescription({children, className, ...rest}: BannerDescriptionProps) { | ||
| return ( | ||
| <div {...rest} className={clsx('BannerDescription', className)}> | ||
| <div {...rest} className={clsx('BannerDescription', className)} data-component="Banner.Description"> | ||
| {children} | ||
| </div> | ||
| ) | ||
| @@ -238,7 +247,7 @@ export type BannerActionsProps = { | ||
| export function BannerActions({primaryAction, secondaryAction}: BannerActionsProps) { | ||
| return ( | ||
| <div className={classes.BannerActions}> | ||
| <div className={classes.BannerActions} data-component="Banner.Actions"> | ||
| <div className={classes.BannerActionsContainer} data-primary-action="trailing"> | ||
| {secondaryAction ?? null} | ||
| {primaryAction ?? null} | ||
| @@ -255,7 +264,13 @@ export type BannerPrimaryActionProps = Omit<ButtonProps, 'variant'> | ||
| const BannerPrimaryAction = forwardRef(({children, className, ...rest}, forwardedRef) => { | ||
| return ( | ||
| <Button ref={forwardedRef} className={clsx('BannerPrimaryAction', className)} variant="default" {...rest}> | ||
| <Button | ||
| data-component="Banner.PrimaryAction" | ||
| ref={forwardedRef} | ||
| className={clsx('BannerPrimaryAction', className)} | ||
| variant="default" | ||
| {...rest} | ||
| > | ||
| {children} | ||
| </Button> | ||
| ) | ||
| @@ -267,7 +282,13 @@ export type BannerSecondaryActionProps = Omit<ButtonProps, 'variant'> | ||
| const BannerSecondaryAction = forwardRef(({children, className, ...rest}, forwardedRef) => { | ||
| return ( | ||
| <Button ref={forwardedRef} className={clsx('BannerPrimaryAction', className)} variant="invisible" {...rest}> | ||
| <Button | ||
| data-component="Banner.SecondaryAction" | ||
| ref={forwardedRef} | ||
| className={clsx('BannerPrimaryAction', className)} | ||
| variant="invisible" | ||
| {...rest} | ||
| > | ||
Comment on lines
+285
to
+291
Member 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. not relevant to this PR but why is this class=BannerPrimaryAction? 😳 ContributorAuthor 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. Good point! I looked into it and it seems like it's been this way since the inception of Member 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. my guess would be if you want a stable class to select 'cause after ours are computed they get a random value added to them, but this definitely feels like an error 🤔 , either way let's keep it outside the scope of this PR | ||
| {children} | ||
| </Button> | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already being useful! 😛