Skip to content

refactor(ui): standardize banners — Phase 1 migration to shared Banner component#2036

Draft
evanjacobson wants to merge 17 commits intomainfrom
improvement/standardize-banners
Draft

refactor(ui): standardize banners — Phase 1 migration to shared Banner component#2036
evanjacobson wants to merge 17 commits intomainfrom
improvement/standardize-banners

Conversation

@evanjacobson
Copy link
Copy Markdown
Contributor

@evanjacobson evanjacobson commented Apr 5, 2026

Summary

Migrate 6 named *Banner.tsx files from hand-rolled divs and shadcn <Alert> to the shared <Banner> compound component, establishing a single source of truth for colored informational/warning/error/success banners. This is Phase 1 of the migration plan in .plans/standardize-banners.md.

Banner component enhancements:

  • Added green color variant and Banner.Dismiss subcomponent (absolute-positioned X button)
  • Added BannerButton variants: primary (solid fill), outline (color border), secondary (gray fill), ghost (transparent)
  • BannerAction stacks buttons vertically on mobile (flex-col sm:flex-row)
  • BannerRoot gains relative positioning for dismiss button placement

Migrated files:

  • OldSessionBanner.tsx — Alert warning → Banner amber
  • ErrorBanner.tsx — Alert destructive → Banner red (outline Retry + ghost Dismiss)
  • AdminViewingBanner.tsx — Alert warning + overrides → Banner amber
  • BillingBanner.tsx — hand-rolled div with color map → Banner blue/amber/red
  • FreeTrialWarningBanner.tsx — hand-rolled div with border-b → Banner blue/amber/red
  • InsufficientBalanceBanner.tsx — hand-rolled div (yellow/blue) → Banner amber/blue (default + compact)

Live before/after preview: https://banner-showcase.pages.dev

Verification

  • pnpm typecheck — passes
  • pnpm format:check — passes
  • Visual verification via deployed showcase (desktop + mobile for all 6 banners, 10 variants total)

Visual Changes

Live before/after preview with desktop/mobile toggle: https://banner-showcase.pages.dev

Before After
shadcn <Alert> with grid layout, small icons, outline buttons <Banner> with flex-wrap layout, larger icons, color-matched buttons
Hand-rolled divs with per-file color maps Shared colorMap in Banner.tsx
No responsive stacking (buttons overflow on mobile) Buttons stack vertically on mobile via flex-col sm:flex-row

Reviewer Notes

  • This is Phase 1 only (6 named *Banner.tsx files). Phases 2-3 (~40 inline banner-like divs across ~25 files) are planned but not in this PR. See .plans/standardize-banners.md for the full scope.
  • The outlineButton field was added to the color map to work around Tailwind v4 not supporting opacity modifiers on currentColor.
  • ErrorBanner no longer has a redundant X dismiss button — the ghost "Dismiss" action button serves that purpose.

… 3 named banner files

- Add green color variant to Banner
- Add Banner.Dismiss subcomponent (X button)
- Migrate OldSessionBanner, AdminViewingBanner, ErrorBanner to shared Banner
- Save standardize-banners migration plan to .plans/
Migrate BillingBanner, FreeTrialWarningBanner, and InsufficientBalanceBanner
to the shared Banner component. Add banner-showcase/ with standalone
before/after comparison page and per-banner app screenshots at desktop
and mobile viewports.
…fix Banner.Action gap

- Add sticky controls bar with width slider, collapse/expand all buttons
- Restructure screenshot galleries to 2 rows (desktop, mobile)
- Make page full-width (remove max-w constraints)
- Fix Banner.Action missing flex gap-2 for multi-button layouts
- Re-capture screenshots with updated button spacing
Remove the banner-showcase/ standalone app (couldn't resolve parent
transitive deps cleanly). Add before/after Storybook stories for all 6
Phase 1 banners under storybook/stories/banner-migration/. These use
the real imported components and run in the existing Storybook infra.

Also add storybook/stories/_pr/ to .gitignore for future ephemeral
PR-scoped stories.
Lightweight standalone preview (~250KB) importing real components from
the parent app via Vite resolve.alias. Features sidebar tabs per
component, variant subtabs, and iframe-based mobile viewport toggle
that correctly triggers Tailwind sm: breakpoints.

Deployed to https://banner-showcase.pages.dev
BannerAction now uses flex-col sm:flex-row so multiple buttons stack
on narrow viewports instead of overflowing side-by-side.
Banner.Dismiss now uses absolute positioning (top-3 right-3) so it
always appears in the top-right corner regardless of flex-wrap layout
or viewport size. BannerRoot gains 'relative' to establish the
positioning context.
The Dismiss action button already handles dismissal — the X was
calling the same onDismiss callback. Removed to avoid duplicate
affordances.
BannerButton now accepts variant='primary' (default, solid fill) or
variant='outline' (transparent with border). ErrorBanner uses outline
for Dismiss to visually differentiate it from the primary Retry action.
The previous outline style used border-current/30 which isn't valid
Tailwind v4 syntax. Added outlineButton to colorMap with explicit
color classes (e.g. border-red-500/40, text-red-400, hover:bg-red-500/10)
for each color.
- secondary: dark gray fill (bg-white/10), neutral — for primary
  actions that shouldn't carry the banner's accent color
- ghost: transparent with subtle text — for de-emphasized actions

ErrorBanner now uses secondary for Retry and ghost for Dismiss,
matching the visual weight of the old Alert-based buttons.
Retry gets the outlined border style, Dismiss stays ghost/transparent.
Remove banner-showcase/, storybook/stories/banner-migration/,
banner-test page, screenshots, and .playwright-mcp artifacts.
Restore pnpm-workspace.yaml and .gitignore to main state.
@evanjacobson evanjacobson force-pushed the improvement/standardize-banners branch from 9b680c0 to 9126d8c Compare April 5, 2026 19:35
@jeanduplessis
Copy link
Copy Markdown
Contributor

Due to the monorepo restructure you will need to recreate this PR on a new branch from main. Pass the prompt found at, https://github.com/Kilo-Org/cloud/blob/main/plans/monorepo-migration-prompt.md, to your coding agent while running in this branch. Please close this PR once done or if you don't plan to proceed with it.

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