diff options
| author | Bertrand Yuan <me@bertyuan.com> | 2026-04-27 20:52:54 +0800 |
|---|---|---|
| committer | Bertrand Yuan <me@bertyuan.com> | 2026-04-27 20:53:14 +0800 |
| commit | dbb5e791f0c228369605d126dd590962ebe1eddc (patch) | |
| tree | 8c83fc84bd9547630e6733929dec77e102e055a8 /Documentation/source/frontend/components.rst | |
| parent | 658798b3a2378bb6df16cfbb16d707c6fb719e1e (diff) | |
docs: add comprehensive documentation for operations
This commit introduces a complete set of documentation files
covering various aspects of the project, including environment
setup, quality checks, command references, and architecture.
The documentation is structured to assist developers and
contributors in understanding the project's configuration,
workflow, and best practices.
Additionally, translations for Simplified and Traditional
Chinese have been added to ensure accessibility for a wider
audience. This enhances the overall usability and
maintainability of the project.
Signed-off-by: Bertrand Yuan <github@bertyuan.com>
Diffstat (limited to 'Documentation/source/frontend/components.rst')
| -rw-r--r-- | Documentation/source/frontend/components.rst | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Documentation/source/frontend/components.rst b/Documentation/source/frontend/components.rst new file mode 100644 index 0000000..fc6fa58 --- /dev/null +++ b/Documentation/source/frontend/components.rst @@ -0,0 +1,52 @@ +Components +========== + +Component Groups +---------------- + +.. list-table:: + :header-rows: 1 + :widths: 26 52 + + * - Area + - Files + * - Layout + - ``src/components/section.tsx``, ``src/components/sections`` + * - Navigation + - ``src/components/active-link.tsx``, header menu and navbar files + * - Posts and tags + - ``src/components/posts/post-card.tsx``, ``src/components/tags`` + * - Forms + - ``src/components/newsletter-form.tsx``, ``src/components/ui/form.tsx`` + * - Auth + - ``src/components/auth/user-button.tsx``, ``user-avatar.tsx`` + * - Rich text + - ``src/components/rich-text`` + * - Base UI + - ``src/components/ui`` + +Component Rules +--------------- + +Use existing primitives first + Before creating a new component, check ``src/components/ui`` and existing + page components for a matching pattern. + +Keep data access out of presentational components + Shared components should receive normalized props. Server components and + ``src/lib`` helpers should handle data fetching. + +Preserve accessibility names + Icon-only buttons and links need explicit labels. Existing tests cover some + components; extend tests when adding new interactive behavior. + +Keep variants local and typed + Use existing ``class-variance-authority`` patterns for variant-heavy + controls instead of ad hoc class switches. + +Testing +------- + +Component tests live beside components using ``*.test.tsx`` or ``*.test.ts``. +Prefer focused tests that assert user-visible behavior, accessibility labels, +and variant output instead of implementation details. |
