Skip to content

feat(react): add Card variant prop, type fixes, and Pro app#85

Merged
wangdicoder merged 17 commits intomasterfrom
feat/card-variant-and-pro-app
Mar 28, 2026
Merged

feat(react): add Card variant prop, type fixes, and Pro app#85
wangdicoder merged 17 commits intomasterfrom
feat/card-variant-and-pro-app

Conversation

@wangdicoder
Copy link
Copy Markdown
Owner

Summary

  • Card variant prop: new outlined | elevated | filled variants for controlling card surface style. outlined is the default (backward compatible with bordered={true}). Deprecated the bordered prop in favor of variant.
  • NativeSelect type fix: children prop now accepts arrays of ReactElement, matching runtime behavior.
  • Table type fix: ColumnType.dataIndex is now optional, supporting action columns that don't map to data fields.
  • Tiny Design Pro app: new Next.js 15 static site (apps/pro/) with 20 block categories and 25 UI blocks showcasing @tiny-design/react components. Features live preview, responsive viewport toggle, source code view, and theme switching.
  • Docs nav: added "Pro" link with badge to the docs site header.
  • Deploy workflow: updated to build and merge the pro app into the combined GitHub Pages deployment at /tiny-design/pro/.

Release

  • Bump: minor (new Card variant feature)
  • Affected packages: @tiny-design/react (and fixed-version group: @tiny-design/tokens, @tiny-design/icons)

Test plan

  • Verify <Card variant="elevated"> renders with box-shadow, no border
  • Verify <Card variant="filled"> renders with fill background
  • Verify <Card variant="outlined"> and <Card bordered> both render with border (backward compat)
  • Verify <Card bordered={false}> still works
  • Verify <NativeSelect> accepts multiple <NativeSelect.Option> children without type errors
  • Verify <Table> accepts columns without dataIndex (action columns)
  • Run pnpm --filter @tiny-design/pro build — static export succeeds
  • Run pnpm --filter @tiny-design/pro dev — blocks render correctly
  • Verify docs site header shows "Pro" link with "New" badge

🤖 Generated with Claude Code

- NativeSelect children type now accepts arrays of ReactElements
- Table ColumnType.dataIndex is now optional for action columns
- Updated getValue helper to handle undefined dataIndex gracefully
- Add CardVariant type: 'outlined' | 'elevated' | 'filled'
- outlined: border (default, same as bordered=true)
- elevated: box-shadow using --ty-shadow-card token
- filled: subtle background using --ty-color-fill token
- variant takes precedence over deprecated bordered prop
- Full backward compatibility: existing bordered prop still works
- Added Variant demo and updated docs (EN + CN)
Next.js 15 static site with 20 block categories and 25 blocks
showcasing @tiny-design/react components. Features include:
- Live preview with responsive viewport toggle (desktop/tablet/mobile)
- Source code view with syntax highlighting and copy button
- Light/dark theme support with anti-FOUC script
- Static export for GitHub Pages deployment at /tiny-design/pro/
- Add "Pro" link with "New" badge to docs header navigation
- Update deploy-site.yml to build and merge pro app output into
  the combined GitHub Pages deployment at /tiny-design/pro/
Replace direct component imports with react-runner's useRunner hook.
Blocks are now rendered from their raw source strings, making the
source code the single source of truth for both preview and code view.
This removes the duplicate dynamic import per block.
Existing Next.js oneOf rules were compiling TSX before the asset/source
loader could read the original text. Now ?raw queries are excluded from
all oneOf sub-rules so the raw source is preserved as-is.
In dev mode, Next.js appends import.meta.webpackHot HMR code to
asset/source modules, causing react-runner's sucrase transform to
fail with "Cannot use import.meta outside a module". Strip the
appended IIFE wrapper before passing the source to useRunner.
Defer theme-dependent icon rendering until after mount to prevent
server/client mismatch when localStorage theme differs from default.
@wangdicoder wangdicoder merged commit 6ab92fd into master Mar 28, 2026
1 check passed
@wangdicoder wangdicoder deleted the feat/card-variant-and-pro-app branch March 28, 2026 21:31
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