Skip to content

feat(badge)!: rework component with variant and color props - #388

Merged
YounixM merged 2 commits into
mainfrom
feat/rework-badge-component
Sep 28, 2026
Merged

YounixM merged 2 commits into
mainfrom
feat/rework-badge-component

Conversation

@H4ad

@H4ad H4ad commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

What

This reworks the Badge to follow the guidelines of https://github.com/SigNoz/engineering-pod/issues/5984

Closes https://github.com/SigNoz/engineering-pod/issues/6050

Component checklist

Philosophy (guidelines)

  • Variants represent meaningful roles (purpose), not one-off visual styling
  • All applicable states handled: default, hover, active, selected, focus, disabled, loading, invalid, read-only
  • Accessibility encoded in component: keyboard, focus, labels, ARIA (not left to consumer)
  • Complex behaviours split into composable patterns, not crammed into conflicting props
  • Escape hatches minimized; CSS overrides are last resort (if exception recurs, evolve the component)

Structure (guidelines)

  • Directory is kebab-case under packages/ui/src/, matches the export subpath
  • index.ts only re-exports (+ generated token region); export type * plus explicit named exports
  • Relative imports use the .js extension; types imported with import type
  • Subcomponents in subcomponents/, opinionated compositions in presets/
  • All four lists updated: src/index.ts, vite.config.ts, package.json exports, README.md + intro.mdx
  • New runtime deps added to externalPatterns

CSS (guidelines)

  • {name}.module.scss, no Tailwind, no CVA, no Sass variables
  • Every overridable value is var(--{component}-x, <design token>); no hardcoded values
  • No literal fallback on a design token (var(--spacing-4, 8px)); a bare literal only where no token matches
  • Colours use semantic tokens only, with no --bg-* / --text-* primitives referenced from a component
  • Values that must not be overridden use --{component}-internal-*
  • No --x: var(--x) and no duplicated variable definitions
  • Variants are data-* attributes; data-slot and data-testid on the root
  • color-mix() for derived shades, never rgba() over a token
  • :hover, :focus-visible, aria-invalid, disabled all styled
  • Transitions use the component's duration/easing tokens and are disabled under @media (prefers-reduced-motion: reduce)
  • pnpm run tokens run and the index.ts region committed

Visual QA (guidelines)

  • Compared against the Figma frame side by side: spacing, sizes, colours, every state
  • Figma frame linked from the story via parameters.design
  • Checked in light and dark
  • Sizing and density consistent with sibling components (sm matches Button / Input)
  • Typography via Typography or the type-scale tokens, not an ad-hoc font-size / font-weight
  • Icons from @signozhq/icons, sized with tokens, no inline SVG with hardcoded px
  • Every state built: default, hover, focus-visible, active, disabled, loading, invalid, selected, empty, long/truncated
  • Not a duplicate of an existing primitive or preset

Types (guidelines)

  • {Component}Props exported; only the props the component actually needs are exposed
  • Upstream-owned prop types borrowed by indexed access (OriginalProps['x']), never restated by hand
  • Every type named by a public prop is exported from index.ts
  • forwardRef + displayName; asChild, testId supported
  • Defaults in the destructuring; controlled/uncontrolled naming follows Radix

Docs (guidelines)

  • JSDoc on every public prop, with @default where applicable
  • Story file per exported component, correct title group
  • argTypes complete with category, type.summary, defaultValue.summary
  • Stories for every meaningful state, not just the happy path
  • {component}.mdx with a usage snippet and a <Controls> per exported piece

Tests (guidelines)

  • Behaviour test per interactive prop
  • forward-ref test
  • run-visual-testing label added if the change is visual

@H4ad
H4ad added this pull request to stack #386 September 9, 2026 22:20
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from d115c4f to 019787f Compare September 10, 2026 17:36
@H4ad
H4ad marked this pull request as ready for review September 10, 2026 18:08
@H4ad
H4ad force-pushed the feat/rework-badge-component branch 2 times, most recently from 8d89d21 to 1e3efb4 Compare September 11, 2026 18:03
@H4ad
H4ad requested a review from a team as a code owner September 14, 2026 04:12
@H4ad
H4ad requested a review from a team September 14, 2026 04:12
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from 1e3efb4 to 16a8d88 Compare September 14, 2026 04:12
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from 16a8d88 to 61890b2 Compare September 15, 2026 12:53
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from 61890b2 to a39f162 Compare September 15, 2026 21:05
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from a39f162 to 5cdc87b Compare September 16, 2026 17:41
@H4ad
H4ad force-pushed the feat/rework-badge-component branch 2 times, most recently from 7423ee1 to e8ccc68 Compare September 22, 2026 21:12
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from e8ccc68 to bc047c1 Compare September 24, 2026 14:53
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from bc047c1 to 4f67326 Compare September 24, 2026 19:44
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from 4f67326 to a458dec Compare September 25, 2026 15:40
@H4ad H4ad changed the title feat(badge): rework component with variant and color props feat(badge)!: rework component with variant and color props Sep 25, 2026
@H4ad
H4ad force-pushed the feat/rework-badge-component branch from a458dec to 487a8e8 Compare September 25, 2026 17:45
@YounixM
YounixM force-pushed the feat/rework-badge-component branch from 487a8e8 to b57a444 Compare September 28, 2026 14:19
@YounixM
YounixM force-pushed the feat/rework-badge-component branch 5 times, most recently from b85bf2c to 80ec8df Compare September 28, 2026 14:40
Base automatically changed from feat/update-storybook-deps to main September 28, 2026 14:40
@YounixM
YounixM force-pushed the feat/rework-badge-component branch from 80ec8df to 6839895 Compare September 28, 2026 14:41
@YounixM
YounixM merged commit c6d0f80 into main Sep 28, 2026
5 checks passed
@YounixM
YounixM deleted the feat/rework-badge-component branch September 28, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants