diff --git a/packages/react-components/react-badge/stories/src/Badge/BadgeColorVsAppearance.stories.tsx b/packages/react-components/react-badge/stories/src/Badge/BadgeColorVsAppearance.stories.tsx index 146a637b8ca8b9..f4a71de31e1912 100644 --- a/packages/react-components/react-badge/stories/src/Badge/BadgeColorVsAppearance.stories.tsx +++ b/packages/react-components/react-badge/stories/src/Badge/BadgeColorVsAppearance.stories.tsx @@ -12,12 +12,23 @@ const useStyles = makeStyles({ }, badge: { display: 'flex', + alignItems: 'center', gap: tokens.spacingHorizontalS, }, brand: { display: 'flex', + alignItems: 'center', + gap: tokens.spacingHorizontalS, backgroundColor: tokens.colorBrandBackground, - padding: tokens.spacingHorizontalXXS, + padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalM}`, + borderRadius: tokens.borderRadiusMedium, + }, + brandLabel: { + color: tokens.colorNeutralForegroundOnBrand, + fontFamily: tokens.fontFamilyBase, + fontSize: tokens.fontSizeBase200, + lineHeight: tokens.lineHeightBase200, + fontWeight: tokens.fontWeightSemibold, }, }); @@ -36,20 +47,29 @@ const Badges = (props: BadgeProps) => { 'warning', ]; + const isSubtleOnBrandOnly = appearance === 'ghost' || appearance === 'outline'; + return (
{colors.map(color => { - const BadgeWrapper = - color === 'subtle' && (appearance === 'ghost' || appearance === 'outline') - ? ({ children }: { children: React.ReactNode }) =>
{children}
- : React.Fragment; + // `ghost-subtle` and `outline-subtle` are only meant to be used on a branded background, + // so they are rendered within an explicit "brand surface" demo container instead of the + // ambient story background. + if (color === 'subtle' && isSubtleOnBrandOnly) { + return ( +
+ On brand background: + }> + 999+ + +
+ ); + } return ( - - }> - 999+ - - + }> + 999+ + ); })}
@@ -76,7 +96,9 @@ export const ColorAndAppearance = (): JSXElement => { ColorAndAppearance.parameters = { docs: { description: { - story: 'Note: `ghost-subtle` and `outline-subtle` are intended only for use on brand background.', + story: + '`ghost-subtle` and `outline-subtle` are intended only for use on a branded background — ' + + 'the boxed "On brand background:" examples above demonstrate the intended usage context.', }, }, };