From dbb5e791f0c228369605d126dd590962ebe1eddc Mon Sep 17 00:00:00 2001 From: Bertrand Yuan Date: Mon, 27 Apr 2026 20:52:54 +0800 Subject: 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 --- Documentation/source/frontend/components.rst | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/source/frontend/components.rst (limited to 'Documentation/source/frontend/components.rst') 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. -- cgit v1.2.3