Skip to content

Commit

Permalink
Beta badge inner visual alignment (#8255)
Browse files Browse the repository at this point in the history
Co-authored-by: Lene Gadewoll <[email protected]>
  • Loading branch information
ek-so and mgadewoll authored Jan 9, 2025
1 parent d4ddf2b commit 9959b18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/eui/changelogs/upcoming/8255.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Updated font-weight and font-size of `EuiBetaBadge`s to improve legibility

20 changes: 14 additions & 6 deletions packages/eui/src/components/badge/beta_badge/beta_badge.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ import { euiBadgeColors } from '../color_utils';
export const euiBetaBadgeStyles = (euiThemeContext: UseEuiTheme) => {
const { euiTheme, colorMode } = euiThemeContext;
const badgeColors = euiBadgeColors(euiThemeContext);
const badgeSizes = {
m: euiTheme.size.l,
s: mathWithUnits(euiTheme.size.base, (x) => x * 1.25),
};

return {
euiBetaBadge: css`
display: inline-block;
border-radius: ${euiTheme.size.l};
cursor: default;
font-weight: ${euiTheme.font.weight.bold};
font-weight: ${euiTheme.font.weight.semiBold};
text-transform: uppercase;
letter-spacing: 0.05em;
text-align: center;
Expand All @@ -53,19 +57,23 @@ export const euiBetaBadgeStyles = (euiThemeContext: UseEuiTheme) => {
// Font sizes
m: css`
font-size: ${euiFontSizeFromScale('xs', euiTheme)};
line-height: ${euiTheme.size.l};
line-height: ${badgeSizes.m};
`,
s: css`
font-size: 0.625rem;
line-height: ${mathWithUnits(euiTheme.size.xs, (x) => x + euiTheme.base)};
font-size: 0.7rem;
line-height: ${badgeSizes.s};
`,
// Padding/width sizes
badgeSizes: {
default: {
m: `
${logicalCSS('padding-horizontal', euiTheme.size.base)}`,
${logicalCSS('height', badgeSizes.m)}
${logicalCSS('padding-horizontal', euiTheme.size.base)}
`,
s: `
${logicalCSS('padding-horizontal', euiTheme.size.m)}`,
${logicalCSS('height', badgeSizes.s)}
${logicalCSS('padding-horizontal', euiTheme.size.m)}
`,
},
// When it's just an icon or a single letter, make the badge a circle
circle: {
Expand Down

0 comments on commit 9959b18

Please sign in to comment.