Refactored "The Blog Zone" frontend to modern standards using Next.js 14, replacing custom HTML/CSS with shadcn/ui components and Tailwind CSS.
What Changed:
- Replaced custom CSS/Tailwind styles with
shadcn/uicomponent library. - Implemented System/Light/Dark mode switching.
How:
- Initialized shadcn:
npx shadcn@latest init - Installed
next-themesand wrapped the app in aThemeProvider(src/components/theme-provider.jsx). - Created a
ModeTogglecomponent for user switching. - Updated
src/app/layout.jsto include theThemeProvider.
What Changed:
- Standardized UI elements (Buttons, Inputs, Cards, Dialogs) across the app.
How:
- Installed specific components via CLI:
npx shadcn@latest add button card input label dropdown-menu avatar skeleton sheet textarea switch checkbox badge separator sonner tabs
- Replaced HTML tags (e.g.,
<button>,<input>) with imports:import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input";
- Grid Layout: Converted post list to a responsive grid of
Cardcomponents. - Search: Added a collapsible search bar using
InputandDropdownMenufor filtering by title/content. - Header: Sticky header with
ModeToggleand navigation.
- Forms: Wrapped in
Cardfor better visual hierarchy. - Validation: Added visual cues using
Inputvariants andsonnertoasts for error handling.
- Privacy Toggle: Replaced radio buttons with
Switchcomponent. - Layout: Centered form in a
Cardfor focus.
- Typography: Improved readability.
- Comments: Styled using
CardandAvatar. - Feedback: Integrated
sonnerfor toast notifications on comment submission/deletion.
- Organization: Used
Tabsto separate "Personal Info" and "Security" settings. - UX: Better feedback for password changes and profile updates.
- Removed unnecessary custom CSS from
globals.css. - Removed hardcoded colors in favor of Tailwind CSS variables (
bg-background,text-foreground) to support theming.