Skip to content

docs(stories): add Storybook catalog for SlackBlockPreview - #18

Merged
zhawtof merged 3 commits into
mainfrom
claude/kind-heyrovsky-c3bcd7
May 16, 2026
Merged

docs(stories): add Storybook catalog for SlackBlockPreview#18
zhawtof merged 3 commits into
mainfrom
claude/kind-heyrovsky-c3bcd7

Conversation

@zhawtof

@zhawtof zhawtof commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds src/components/preview/slack-block-preview.stories.tsx with one story per supported block type (header, section, divider, context, actions, image, markdown, rich_text, input, card, carousel, context_actions, alert, table).
  • Adds a DarkTheme story showing data-theme="dark" styling, and a WithDirectiveHooks story demonstrating user/channel/emoji hook resolution.
  • Exposes the component's theme prop as a Storybook arg so reviewers can toggle light/dark from the controls panel without opening a separate story.

Why

SlackBlockPreview is the visual core of the builder, but until now it was only exercised through the full BlockKitBuilder story. This adds a per-block-type catalog that doubles as living documentation for which block payloads render correctly.

Test plan

  • pnpm typecheck (clean)
  • pnpm test (52/52 passing via pre-push hook)
  • Verified in Storybook (port 6008 locally) that all 18 stories load without runtime errors; spot-checked Header, Section, Card, Table, Actions, DarkTheme (data-theme="dark", slack-dark background), and WithDirectiveHooks (<@U123>@user-U123, <#C456>#channel-C456).

🤖 Generated with Claude Code

zhawtof and others added 3 commits May 15, 2026 20:12
Adds one story per supported block type (header, section, divider,
context, actions, image, markdown, rich_text, input, card, carousel,
context_actions, alert, table), plus a DarkTheme variant and a
WithDirectiveHooks demo. Provides a visual catalog of every block
type the preview renders, with a live theme toggle in the controls
panel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Markdown link, Carousel scrollable region, and DarkTheme button
trip axe rules that live in the upstream slack-blocks-to-jsx markup
and can't be fixed from the consumer side. Match the rest of the
story suite by setting `a11y: { test: 'todo' }` on the meta so axe
still reports the violations in the addon panel without failing the
vitest storybook project.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds three #slack_blocks_to_jsx-scoped CSS overrides so the preview
satisfies axe a11y rules at render time instead of suppressing them at
test time:

- Inline code: darken from #e01e5a to #c4144b (4.31:1 → 5.9:1 vs the
  tinted background, hits WCAG AA's 4.5:1).
- Markdown links: always-on underline so links don't rely on color
  alone (WCAG 1.4.1). Upstream only underlines on :hover.
- Primary / danger buttons in dark mode: force white text on
  .bg-green-primary and .bg-red-primary, where upstream applied the
  light-grey dark-text token (3.52:1 and 3.19:1) on saturated fills.

Also drops the now-redundant DarkTheme story (the meta already exposes
`theme` as an inline-radio arg, so any story can be toggled) and adds
focusable buttons to the Carousel fixture so the scrollable region has
keyboard-reachable content. With these fixes, the previous
`a11y: { test: 'todo' }` flag is removed and axe runs as a hard check
against every story.

Verified locally: `vitest run --project storybook` 39/39 passing,
axe.run() returns zero violations on Markdown, Carousel, and Actions
(dark theme).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zhawtof
zhawtof merged commit eb53178 into main May 16, 2026
4 of 6 checks passed
@zhawtof
zhawtof deleted the claude/kind-heyrovsky-c3bcd7 branch May 16, 2026 00:32
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.

1 participant