-
Notifications
You must be signed in to change notification settings - Fork 0
Frontend Styling Guide
yusuf anil yazici edited this page Apr 24, 2025
·
1 revision
This document outlines the styling system used in the NutriHub frontend application. The system is built on top of Tailwind CSS and custom CSS components, with support for both light and dark themes.
The application uses CSS variables for consistent theming across components. There are two main themes:
-
Dark Theme (Default)
- Dark backgrounds with light text
- Blue accent colors
- Deep shadows

-
Light Theme
- Light yellowish backgrounds
- Green navbar/footer
- Lighter shadows

The theme can be toggled using the ThemeToggle
component. The theme class light-theme
is applied to the root element when in light mode.
.nh-card {
background-color: var(--color-bg-secondary);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
padding: var(--space-6);
overflow: hidden;
border: 1px solid var(--color-gray-800);
}

.nh-button {
display: inline-block;
padding: var(--space-2) var(--space-4);
border-radius: var(--radius-md);
font-weight: 500;
transition: all 0.2s ease;
}
/* Button variants */
.nh-button-primary .nh-button-secondary .nh-button-outline .nh-button-lg;

.nh-title .nh-title-lg .nh-subtitle .nh-text .nh-text-light;

.nh-container .nh-grid .nh-navbar .nh-footer;
<div className="nh-card">
<h3 className="nh-subtitle">Card Title</h3>
<p className="nh-text">Card content</p>
</div>
<button className="nh-button nh-button-primary">
Primary Button
</button>
<button className="nh-button nh-button-secondary">
Secondary Button
</button>
<button className="nh-button nh-button-outline">
Outline Button
</button>
<h1 className="nh-title-lg">Large Title</h1>
<h2 className="nh-title">Regular Title</h2>
<h3 className="nh-subtitle">Subtitle</h3>
<p className="nh-text">Regular text</p>
<p className="nh-text-light">Light text</p>
<div className="nh-container">
<div className="nh-grid">{/* Grid items */}</div>
</div>
-
Consistent Spacing
- Use the predefined spacing variables (
--space-*
) - Example:
padding: var(--space-4)
- Use the predefined spacing variables (
-
Responsive Design
- Use Tailwind's responsive prefixes (md:, lg:, etc.)
- Example:
className="flex flex-col md:flex-row"
-
Theme Awareness
- Always consider both light and dark themes
- Use theme variables for colors
- Example:
color: var(--color-light)
-
Component Composition
- Combine utility classes with component classes
- Example:
className="nh-card flex items-center"
--color-primary
--color-primary-hover
--color-bg-primary
--color-bg-secondary
--color-bg-tertiary
--color-dark
--color-light
--space-1: 0.25rem
--space-2: 0.5rem
--space-4: 1rem
--space-6: 1.5rem
--space-8: 2rem
--radius-sm: 0.125rem
--radius-md: 0.375rem
--radius-lg: 0.5rem
--shadow-sm
--shadow-md
--shadow-lg
<nav className="nh-navbar">
<div className="nh-container">{/* Navbar content */}</div>
</nav>
<footer className="nh-footer">
<div className="nh-container">{/* Footer content */}</div>
</footer>
<div className="nh-grid">
<div className="nh-card">{/* Card content */}</div>
{/* More cards */}
</div>
- Always use the provided component classes for consistency
- Custom styles should be added sparingly and only when necessary
- Test components in both light and dark themes
- Use Tailwind utilities for layout and spacing when appropriate


-
Use Cases:
- Template
- Scenario 1: Community Sharing
- Scenario 2: For a Dietitian
- Scenario 3: Maintaining a Personal Inventory (as a Producer)
- Scenario 4: Proposing a Product and Adding a Recipe to Weekly Meal Plan
- Scenario 5: Creating a Meal Plan
- Scenario 6: Resetting Password
- Scenario 7: Moderator Actions
- Scenario 8: Searching for and Proposing a New Food Item
- Scenario 9: Budget-Conscious Grocery Shopping
- Scenario 10: Creating a New Store
- Scenario 11: User Profile Management
- Git: In a Nutshell
- Example GitHub Repositories
- System Modeling & UML
- Frontend Tutorial
- Frontend Roadmap
- Frontend Styling Guide
- Docker Summary
- Writing Endpoints
- Yusuf AKIN
- Arda SAYGAN
- Fatih Furkan Bilsel
- Berk GOKTAS
- Berkay BILEN
- Yusuf Anıl YAZICI
- Taha Topaloglu
- Nuri Basar
- Onur Kucuk
- Hasancan Keles
- Mete Damar