Skip to content

feat(empty-state): new TEDI-Ready component #10#611

Merged
airikej merged 4 commits into
rcfrom
feat/10-emptystate-new-tedi-ready-component
May 7, 2026
Merged

feat(empty-state): new TEDI-Ready component #10#611
airikej merged 4 commits into
rcfrom
feat/10-emptystate-new-tedi-ready-component

Conversation

@airikej
Copy link
Copy Markdown
Contributor

@airikej airikej commented Apr 23, 2026

Summary by CodeRabbit

  • New Features

    • Added EmptyState component with configurable layout types (separate, attached, inside), padding sizes, optional icons, headings, descriptions, and action buttons.
  • Tests

    • Added comprehensive unit test coverage for EmptyState.
  • Documentation

    • Added Storybook stories demonstrating EmptyState variations and use cases.

@airikej airikej linked an issue Apr 23, 2026 that may be closed by this pull request
21 tasks
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Review Change Stack

Warning

Rate limit exceeded

@airikej has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 15 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd91a5a5-e3cd-4dbc-9b66-b0fa20bd5f81

📥 Commits

Reviewing files that changed from the base of the PR and between 130928f and 4183093.

📒 Files selected for processing (6)
  • src/tedi/components/misc/empty-state/empty-state.module.scss
  • src/tedi/components/misc/empty-state/empty-state.spec.tsx
  • src/tedi/components/misc/empty-state/empty-state.stories.tsx
  • src/tedi/components/misc/empty-state/empty-state.tsx
  • src/tedi/components/misc/empty-state/index.ts
  • src/tedi/index.ts
📝 Walkthrough

Walkthrough

This PR introduces a complete EmptyState notification component to the TEDI Design System. It adds a reusable React component with configurable layout types (separate, attached, inside), padding sizes, optional icon rendering, heading, body content, and actions, paired with SCSS styling, comprehensive unit tests, and Storybook documentation.

Changes

EmptyState Component

Layer / File(s) Summary
Type Definitions
src/tedi/components/notifications/empty-state/empty-state.tsx
Exports EmptyStateType ('separate' | 'attached' | 'inside'), EmptyStateSize ('default' | 'small'), and EmptyStateProps interface with icon, heading, children, actions, and className.
Component Styling
src/tedi/components/notifications/empty-state/empty-state.module.scss
Defines .tedi-empty-state base container with flex layout, configurable gap/padding, background, border, and radius; adds size modifiers (--small), layout variants (--attached, --inside), and element classes for icon, text, content, heading, description, and actions positioning.
Component Implementation
src/tedi/components/notifications/empty-state/empty-state.tsx
Computes root CSS classes from type/size/className; conditionally renders icon (supports string name, IconProps object, or null); renders heading and content block when applicable; renders actions container when provided; sets displayName for debugging.
Public API Exports
src/tedi/components/notifications/empty-state/index.ts, src/tedi/index.ts
Re-exports EmptyState component and type definitions (EmptyStateProps, EmptyStateSize, EmptyStateType) through package barrel exports.
Unit Tests
src/tedi/components/notifications/empty-state/empty-state.spec.tsx
Verifies children/heading/actions rendering, icon variants (string/object/null), CSS class behavior for type/size variants and className merging, conditional wrapper omission, and displayName equality.
Storybook Stories
src/tedi/components/notifications/empty-state/empty-state.stories.tsx
Configures Storybook meta with hidden controls; provides 11 stories covering default text, action button variants (primary/secondary/link), heading combinations, size/type variants, and contextual placements within Card components.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • mart-sessman
  • ly-tempel-bitweb
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding a new EmptyState component to the TEDI design system.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/10-emptystate-new-tedi-ready-component

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@airikej
Copy link
Copy Markdown
Contributor Author

airikej commented Apr 24, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread src/tedi/components/notifications/empty-state/empty-state.tsx Outdated
Comment thread src/tedi/components/misc/empty-state/empty-state.tsx
@airikej airikej temporarily deployed to github-pages May 5, 2026 06:34 — with GitHub Actions Inactive
@airikej airikej requested a review from ly-tempel-bitweb May 6, 2026 07:03
@airikej airikej temporarily deployed to github-pages May 7, 2026 07:05 — with GitHub Actions Inactive
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/tedi/components/notifications/empty-state/empty-state.stories.tsx (1)

136-139: ⚡ Quick win

Story comment is outdated: icon no longer accepts arbitrary ReactNode.

Please align this note with the current prop type (string | IconWithoutBackgroundProps | null) to avoid misleading usage guidance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tedi/components/notifications/empty-state/empty-state.stories.tsx` around
lines 136 - 139, The story comment for the `icon` prop is outdated — it says
"Any ReactNode" but the prop type is now `string | IconWithoutBackgroundProps |
null`; update the comment in empty-state.stories.tsx to state that `icon`
accepts either a string (icon name), an `IconWithoutBackgroundProps` object, or
null, and remove the reference to arbitrary `ReactNode` so users are not misled
when using the `icon` prop of the EmptyState story/component.
src/tedi/components/notifications/empty-state/empty-state.spec.tsx (1)

13-42: ⚡ Quick win

Use semantic RTL queries for icon/heading assertions instead of querySelector.

These tests can rely on screen.getByRole(...) / screen.getByText(...) and avoid DOM selectors for behavior-level assertions.

Suggested direction
- const { container } = render(<EmptyState heading="Choose new time">You have no data to display</EmptyState>);
- const heading = container.querySelector('h3');
- expect(heading).toBeInTheDocument();
- expect(heading).toHaveTextContent('Choose new time');
+ render(<EmptyState heading="Choose new time">You have no data to display</EmptyState>);
+ expect(screen.getByRole('heading', { level: 3, name: 'Choose new time' })).toBeInTheDocument();

As per coding guidelines, "Use semantic queries in tests (getByRole, getByLabelText) instead of non-semantic queries (getByTestId)."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tedi/components/notifications/empty-state/empty-state.spec.tsx` around
lines 13 - 42, Replace DOM querySelector checks with semantic RTL queries: for
icon assertions in tests like "renders the default spa icon..." / "renders the
icon named by a string icon prop" / "accepts a full IconProps object for the
icon" use screen.getByText('spa' | 'event_busy' | 'inbox') or, if the icon
renders with an accessible name/role, use screen.getByRole('img', { name:
/spa|event_busy|inbox/i }) to assert presence and text; for the "hides the icon
when icon is null" test use screen.queryByText(...) or screen.queryByRole('img')
to assert absence; and for the heading test replace
container.querySelector('h3') with screen.getByRole('heading', { level: 3, name:
'Choose new time' }) or screen.getByText('Choose new time'). Update imports to
use screen from `@testing-library/react` if needed and adjust the four/five tests
to use these semantic queries instead of
container.querySelector('[data-name="icon"]') and container.querySelector('h3').
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/tedi/components/notifications/empty-state/empty-state.spec.tsx`:
- Around line 13-42: Replace DOM querySelector checks with semantic RTL queries:
for icon assertions in tests like "renders the default spa icon..." / "renders
the icon named by a string icon prop" / "accepts a full IconProps object for the
icon" use screen.getByText('spa' | 'event_busy' | 'inbox') or, if the icon
renders with an accessible name/role, use screen.getByRole('img', { name:
/spa|event_busy|inbox/i }) to assert presence and text; for the "hides the icon
when icon is null" test use screen.queryByText(...) or screen.queryByRole('img')
to assert absence; and for the heading test replace
container.querySelector('h3') with screen.getByRole('heading', { level: 3, name:
'Choose new time' }) or screen.getByText('Choose new time'). Update imports to
use screen from `@testing-library/react` if needed and adjust the four/five tests
to use these semantic queries instead of
container.querySelector('[data-name="icon"]') and container.querySelector('h3').

In `@src/tedi/components/notifications/empty-state/empty-state.stories.tsx`:
- Around line 136-139: The story comment for the `icon` prop is outdated — it
says "Any ReactNode" but the prop type is now `string |
IconWithoutBackgroundProps | null`; update the comment in
empty-state.stories.tsx to state that `icon` accepts either a string (icon
name), an `IconWithoutBackgroundProps` object, or null, and remove the reference
to arbitrary `ReactNode` so users are not misled when using the `icon` prop of
the EmptyState story/component.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9f0120e7-e713-4624-83b0-bf0897031fb4

📥 Commits

Reviewing files that changed from the base of the PR and between a5af699 and 130928f.

📒 Files selected for processing (6)
  • src/tedi/components/notifications/empty-state/empty-state.module.scss
  • src/tedi/components/notifications/empty-state/empty-state.spec.tsx
  • src/tedi/components/notifications/empty-state/empty-state.stories.tsx
  • src/tedi/components/notifications/empty-state/empty-state.tsx
  • src/tedi/components/notifications/empty-state/index.ts
  • src/tedi/index.ts

Comment thread src/tedi/components/notifications/empty-state/empty-state.stories.tsx Outdated
Comment thread src/tedi/components/notifications/empty-state/index.ts Outdated
@airikej airikej temporarily deployed to github-pages May 7, 2026 09:50 — with GitHub Actions Inactive
@airikej airikej merged commit 490cf4d into rc May 7, 2026
22 checks passed
@airikej airikej deleted the feat/10-emptystate-new-tedi-ready-component branch May 7, 2026 11:32
github-actions Bot pushed a commit that referenced this pull request May 7, 2026
# [17.1.0-rc.3](react-17.1.0-rc.2...react-17.1.0-rc.3) (2026-05-07)

### Features

* **empty-state:** new TEDI-Ready component [#10](#10) ([#611](#611)) ([490cf4d](490cf4d))
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.

[EmptyState]: New TEDI-Ready component

2 participants