-
Notifications
You must be signed in to change notification settings - Fork 0
Component Templates ‐ Initial Structure Guide
This document provides the basic HTML structure and element breakdown for each component in the Class Notes App. Use this as a reference when implementing components.
File: src/components/ui/Button/Button.tsx
HTML Elements:
-
<button>- Main button element- Attributes:
type,disabled,onClick,className - DaisyUI classes:
btn,btn-primary,btn-secondary,btn-ghost,btn-sm,btn-md,btn-lg
- Attributes:
Props:
-
children: ReactNode -
variant: 'primary' | 'secondary' | 'ghost' -
size: 'sm' | 'md' | 'lg' -
disabled: boolean -
onClick: () => void -
type: 'button' | 'submit' | 'reset'
File: src/components/ui/Input/Input.tsx
HTML Elements:
-
<div>- Wrapper container-
<label>- Label for the input (if provided) -
<input>- Main input element- Attributes:
type,value,onChange,placeholder,disabled,required - DaisyUI classes:
input,input-bordered,input-error
- Attributes:
-
<span>- Error message display (conditional)- Classes:
text-error,text-sm
- Classes:
-
Props:
-
label: string -
type: 'text' | 'email' | 'password' | 'number' -
value: string | number -
onChange: (e: ChangeEvent) => void -
placeholder: string -
error: string -
disabled: boolean -
required: boolean
File: src/components/ui/Card/Card.tsx
HTML Elements:
-
<div>- Main card container- DaisyUI classes:
card,card-bordered,bg-base-100,shadow-xl -
<div>- Card body- Classes:
card-body -
{children}- Card content
- Classes:
- DaisyUI classes:
Props:
-
children: ReactNode -
className: string -
onClick: () => void -
bordered: boolean -
shadow: boolean
File: src/components/ui/Badge/Badge.tsx
HTML Elements:
-
<div>- Badge container- DaisyUI classes:
badge,badge-primary,badge-secondary -
<span>- Badge text -
<button>- Remove button (optional)- Classes:
btn,btn-ghost,btn-xs - Contains:
×or close icon
- Classes:
- DaisyUI classes:
Props:
-
text: string -
color: string -
variant: 'primary' | 'secondary' | 'accent' | 'ghost' -
removable: boolean -
onRemove: () => void
File: src/components/ui/Modal/Modal.tsx
HTML Elements:
-
<dialog>- Native dialog element (DaisyUI modal)- Classes:
modal -
<div>- Modal box- Classes:
modal-box -
<h3>- Modal title -
<div>- Modal content -
<div>- Modal actions- Classes:
modal-action - Contains: Action buttons
- Classes:
- Classes:
- Classes:
Props:
-
isOpen: boolean -
onClose: () => void -
title: string -
children: ReactNode -
actions: ReactNode
File: src/components/ui/Dropdown/Dropdown.tsx
HTML Elements:
-
<div>- Dropdown container- Classes:
dropdown -
<label>- Dropdown trigger- Classes:
btn
- Classes:
-
<ul>- Dropdown menu- Classes:
dropdown-content,menu,p-2,shadow,bg-base-100,rounded-box -
<li>(multiple) - Menu items-
<a>- Menu item link/button
-
- Classes:
- Classes:
Props:
-
trigger: ReactNode -
items: Array<{ label: string; value: string; onClick: () => void }> -
position: 'top' | 'bottom' | 'left' | 'right'
File: src/components/layout/Header/Header.tsx
HTML Elements:
-
<header>- Main header element- Classes:
navbar,bg-base-100,shadow-lg -
<div>- Navbar start- Classes:
navbar-start -
<a>- Logo/brand
- Classes:
-
<div>- Navbar center (optional)- Classes:
navbar-center
- Classes:
-
<div>- Navbar end- Classes:
navbar-end - Contains: ThemeToggle, UserMenu
- Classes:
- Classes:
Props:
-
user: User | null -
onLogout: () => void
Child Components:
- Logo/Brand text
- ThemeToggle
- UserMenu (Dropdown)
File: src/components/layout/Layout/Layout.tsx
HTML Elements:
-
<div>- Main layout container- Classes:
min-h-screen,bg-base-200 - Header component
-
<main>- Main content area- Classes:
container,mx-auto,p-4 -
<Outlet />- React Router outlet
- Classes:
- Classes:
Props:
-
children: ReactNode (alternative to Outlet)
File: src/components/layout/ThemeToggle/ThemeToggle.tsx
HTML Elements:
-
<label>- Theme controller- Classes:
swap,swap-rotate -
<input>- Checkbox for theme toggle- Attributes:
type="checkbox",className="theme-controller"
- Attributes:
-
<svg>- Sun icon (light theme)- Classes:
swap-on
- Classes:
-
<svg>- Moon icon (dark theme)- Classes:
swap-off
- Classes:
- Classes:
Props:
- None (uses ThemeContext)
File: src/components/features/auth/LoginForm/LoginForm.tsx
HTML Elements:
-
<div>- Form container- Classes:
card,w-96,bg-base-100,shadow-xl -
<div>- Card body-
<h2>- Form title -
<div>- Form fields container- Input component (email)
- Input component (password)
-
<div>- Form actions- Button component (submit)
-
<div>- Error message display (conditional)
-
- Classes:
Props:
-
onLogin: (credentials: LoginCredentials) => void -
onError: (error: string) => void -
isLoading: boolean
File: src/components/features/notes/NoteCard/NoteCard.tsx
HTML Elements:
- Card component wrapper
-
<div>- Card header-
<h3>- Note title -
<div>- Action buttons- Button (edit)
- Button (delete)
-
-
<div>- Note preview- NotePreview component
-
<div>- Note metadata-
<div>- Author info-
<span>- Author name
-
-
<div>- Date info-
<span>- Created/Updated date
-
-
-
<div>- Tags container- TagBadge components (multiple)
-
Props:
-
note: Note -
onEdit: (noteId: string) => void -
onDelete: (noteId: string) => void -
onClick: (noteId: string) => void
File: src/components/features/notes/NotePreview/NotePreview.tsx
HTML Elements:
-
<div>- Preview container- Classes:
line-clamp-3,text-base-content -
<p>- Plain text content (stripped HTML)
- Classes:
Props:
-
content: string (HTML content) -
maxLength: number
File: src/components/features/notes/NotesList/NotesList.tsx
HTML Elements:
-
<div>- List container- Classes:
grid,gap-4,grid-cols-1,md:grid-cols-2,lg:grid-cols-3 - NoteCard components (multiple)
- OR
-
<div>- Empty state (conditional)- Classes:
text-center,py-12 -
<p>- Empty message - Button - Create first note
- Classes:
- Classes:
Props:
-
notes: Note[] -
onEdit: (noteId: string) => void -
onDelete: (noteId: string) => void -
onNoteClick: (noteId: string) => void -
isLoading: boolean
File: src/components/features/notes/RichTextEditor/RichTextEditor.tsx
HTML Elements:
-
<div>- Editor wrapper- Classes:
border,rounded-lg,bg-base-100 -
<div>- Quill toolbar (ref)- Toolbar buttons (provided by Quill)
-
<div>- Quill editor container (ref)- Classes:
min-h-[300px],p-4
- Classes:
- Classes:
Props:
-
value: string (HTML content) -
onChange: (content: string) => void -
placeholder: string -
readOnly: boolean
Note: Uses Quill library with refs
File: src/components/features/tags/TagBadge/TagBadge.tsx
HTML Elements:
- Badge component wrapper
-
<span>- Tag name -
<button>- Remove button (if removable)- Classes:
btn,btn-ghost,btn-xs,ml-1 - Contains:
×
- Classes:
-
Props:
-
tag: string | Tag -
removable: boolean -
onRemove: () => void -
onClick: () => void -
color: string
File: src/components/features/tags/TagInput/TagInput.tsx
HTML Elements:
-
<div>- Input wrapper-
<div>- Selected tags container- Classes:
flex,flex-wrap,gap-2,mb-2 - TagBadge components (for selected tags)
- Classes:
- Input component - Tag input field
-
<div>- Suggestions dropdown (conditional)- Classes:
absolute,bg-base-100,shadow-lg,rounded-box -
<ul>- Suggestions list-
<li>(multiple) - Suggestion items
-
- Classes:
-
Props:
-
tags: string[] -
onChange: (tags: string[]) => void -
suggestions: string[] -
placeholder: string
File: src/components/features/tags/TagSelector/TagSelector.tsx
HTML Elements:
-
<div>- Selector container- Classes:
card,bg-base-100,p-4 -
<h4>- Section title - TagInput component
-
<div>- All tags section-
<p>- Section label -
<div>- Tags grid- Classes:
flex,flex-wrap,gap-2 - TagBadge components (clickable)
- Classes:
-
- Classes:
Props:
-
selectedTags: string[] -
onChange: (tags: string[]) => void -
allTags: string[]
File: src/components/features/search/SearchBar/SearchBar.tsx
HTML Elements:
-
<div>- Search container- Classes:
relative -
<div>- Input wrapper- Input component
-
<button>- Search icon (left) -
<button>- Clear button (right, conditional)- Contains:
×
- Contains:
- Classes:
Props:
-
value: string -
onChange: (value: string) => void -
onClear: () => void -
placeholder: string
File: src/components/features/search/FilterBar/FilterBar.tsx
HTML Elements:
-
<div>- Filter bar container- Classes:
flex,flex-wrap,gap-4,items-center,p-4,bg-base-100 -
<div>- Tag filters section-
<span>- Label -
<div>- Selected tags- TagBadge components (removable)
- Dropdown component - Tag selection
-
-
<div>- Sort section-
<span>- Label - Dropdown component - Sort options
-
- Classes:
Props:
-
selectedTags: string[] -
onTagSelect: (tags: string[]) => void -
availableTags: string[] -
sortBy: 'createdAt' | 'updatedAt' | 'title' -
sortOrder: 'asc' | 'desc' -
onSortChange: (sortBy: string, order: string) => void
File: src/pages/LoginPage/LoginPage.tsx
HTML Elements:
-
<div>- Page container- Classes:
min-h-screen,flex,items-center,justify-center,bg-base-200 -
<div>- Content wrapper-
<h1>- Page title - LoginForm component
-
<p>- Additional info/links (optional)
-
- Classes:
Props:
- None (uses AuthContext and navigation)
File: src/pages/DashboardPage/DashboardPage.tsx
HTML Elements:
-
<div>- Page container-
<div>- Page header-
<h1>- Page title - Button - Create new note
-
- SearchBar component
- FilterBar component
-
<div>- Notes section- NotesList component
-
<button>- Floating action button (mobile)- Classes:
btn,btn-circle,btn-primary,fixed,bottom-8,right-8 - Contains:
+icon
- Classes:
-
Props:
- None (uses hooks for data management)
File: src/pages/NoteEditorPage/NoteEditorPage.tsx
HTML Elements:
-
<div>- Page container-
<div>- Editor header- Button - Back button
- Input component - Title input
- Button - Save button
-
<span>- Save status indicator
-
<div>- Editor body- Classes:
grid,gap-4,lg:grid-cols-3 -
<div>- Main editor area (lg:col-span-2)- RichTextEditor component
-
<div>- Sidebar (lg:col-span-1)- TagSelector component
-
<div>- Metadata section-
<p>- Word count -
<p>- Character count -
<p>- Last saved time
-
- Classes:
-
Props:
- None (uses route params and hooks)
File: src/pages/NotFoundPage/NotFoundPage.tsx
HTML Elements:
-
<div>- Page container- Classes:
min-h-screen,flex,items-center,justify-center,bg-base-200 -
<div>- Content wrapper- Classes:
text-center -
<h1>- 404 heading -
<p>- Error message - Button - Back to home
- Classes:
- Classes:
Props:
- None
File: src/routes/ProtectedRoute.tsx
HTML Elements:
- Conditional rendering:
- If authenticated:
<Outlet />or{children} - If not authenticated:
<Navigate to="/login" />
- If authenticated:
Props:
-
children: ReactNode (optional)