summaryrefslogtreecommitdiff
path: root/Documentation/source/frontend/components.rst
diff options
context:
space:
mode:
authorBertrand Yuan <189593334+bertyuan@users.noreply.github.com>2026-04-27 20:54:16 +0800
committerGitHub <noreply@github.com>2026-04-27 20:54:16 +0800
commit85b6fb59db5fe1112c58eff9d02ae4f9c9b6456d (patch)
tree8c83fc84bd9547630e6733929dec77e102e055a8 /Documentation/source/frontend/components.rst
parent658798b3a2378bb6df16cfbb16d707c6fb719e1e (diff)
parentdbb5e791f0c228369605d126dd590962ebe1eddc (diff)
Merge pull request #21 from bertyuan/Documentationv1.2
docs: add comprehensive documentation for operations
Diffstat (limited to 'Documentation/source/frontend/components.rst')
-rw-r--r--Documentation/source/frontend/components.rst52
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.