neutral: 'pillNeutral',
};
+const variantThemeBorderColors: Record<PillVariant, ThemeColors> = {
+ danger: 'pillDangerBorder',
+ warning: 'pillWarningBorder',
+ info: 'pillInfoBorder',
+ neutral: 'pillNeutralBorder',
+};
+
interface PillProps {
['aria-label']?: string;
children: ReactNode;
export function Pill({ children, variant, ...rest }: PillProps) {
return (
- <StyledPill color={variantThemeColors[variant]} {...rest}>
+ <StyledPill variant={variant} {...rest}>
{children}
</StyledPill>
);
}
const StyledPill = styled.span<{
- color: ThemeColors;
+ variant: PillVariant;
}>`
${tw`sw-body-sm`};
${tw`sw-w-fit`};
${tw`sw-px-[8px] sw-py-[2px]`};
${tw`sw-rounded-pill`};
- color: ${({ color }) => themeContrast(color)};
- background-color: ${({ color }) => themeColor(color)};
+ background-color: ${({ variant }) => themeContrast(variantThemeColors[variant])};
+ background-color: ${({ variant }) => themeColor(variantThemeColors[variant])};
+ color: ${({ variant }) => themeContrast(variantThemeColors[variant])};
+ border-style: ${({ variant }) => (variant === 'neutral' ? 'hidden' : 'solid')};
+ border-color: ${({ variant }) => themeColor(variantThemeBorderColors[variant])};
+ border-width: 1px;
&:empty {
${tw`sw-hidden`}
badgeCounter: COLORS.blueGrey[100],
// pills
- pillDanger: COLORS.red[100],
- pillWarning: COLORS.yellow[100],
- pillInfo: COLORS.blue[100],
+ pillDanger: COLORS.red[50],
+ pillDangerBorder: COLORS.red[300],
+ pillWarning: COLORS.yellow[50],
+ pillWarningBorder: COLORS.yellow[300],
+ pillInfo: COLORS.blue[50],
+ pillInfoBorder: COLORS.blue[300],
pillNeutral: COLORS.blueGrey[50],
+ pillNeutralBorder: 'transparent',
// input select
selectOptionSelected: secondary.light,
destructiveIconFocus: danger.default,
// icons
- iconSoftwareImpactSeverityHigh: COLORS.red[700],
- iconSoftwareImpactSeverityMedium: COLORS.yellow[800],
+ iconSoftwareImpactSeverityHigh: COLORS.red[500],
+ iconSoftwareImpactSeverityMedium: COLORS.yellow[700],
iconSoftwareImpactSeverityLow: COLORS.blue[700],
iconSeverityMajor: danger.light,
iconSeverityMinor: COLORS.yellowGreen[400],
// pills
pillDanger: COLORS.red[800],
+ pillDangerIcon: COLORS.red[700],
pillWarning: COLORS.yellow[800],
+ pillWarningIcon: COLORS.yellow[700],
pillInfo: COLORS.blue[800],
- pillNeutral: COLORS.blueGrey[500],
+ pillInfoIcon: COLORS.blue[700],
+ pillNeutral: COLORS.blueGrey[800],
// breadcrumbs
breadcrumb: secondary.dark,