chore: release [ci skip]
This commit is contained in:
+79
-50
@@ -6,7 +6,9 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The `layouts/` directory contains layout-level components used across all pages. These are included in the root layout and provide consistent header/footer across the application.
|
||||
The `layouts/` directory contains layout-level components used across all pages.
|
||||
These are included in the root layout and provide consistent header/footer
|
||||
across the application.
|
||||
|
||||
```
|
||||
layouts/
|
||||
@@ -19,9 +21,8 @@ layouts/
|
||||
|
||||
## Header (layouts/header.tsx)
|
||||
|
||||
**File:** layouts/header.tsx
|
||||
**Type:** Client component
|
||||
**Description:** Sticky top navigation bar with brand info and authentication status display.
|
||||
**File:** layouts/header.tsx **Type:** Client component **Description:** Sticky
|
||||
top navigation bar with brand info and authentication status display.
|
||||
|
||||
### Layout
|
||||
|
||||
@@ -33,48 +34,53 @@ height: 72px (var(--spacing-header-height))
|
||||
```
|
||||
|
||||
**2-Column Layout:**
|
||||
|
||||
- **Left:** Shop branding (logo + name + tagline)
|
||||
- **Right:** Auth status indicator
|
||||
|
||||
### Features
|
||||
|
||||
#### Logo & Branding
|
||||
|
||||
- Shop logo (40x40px)
|
||||
- Shop name (bold text)
|
||||
- Tagline (hidden on mobile < md, visible md+)
|
||||
|
||||
**Responsive:**
|
||||
| Breakpoint | Logo | Name | Tagline |
|
||||
|-----------|------|------|---------|
|
||||
| < sm (640px) | Yes | Yes | Hidden |
|
||||
| sm-md | Yes | Yes | Hidden |
|
||||
| md+ (768px) | Yes | Yes | Visible |
|
||||
**Responsive:** | Breakpoint | Logo | Name | Tagline |
|
||||
|-----------|------|------|---------| | < sm (640px) | Yes | Yes | Hidden | |
|
||||
sm-md | Yes | Yes | Hidden | | md+ (768px) | Yes | Yes | Visible |
|
||||
|
||||
#### Authentication Status
|
||||
|
||||
The header cycles through 3 auth states (for UI demo):
|
||||
|
||||
**State 1: Guest (Not logged in)**
|
||||
|
||||
```
|
||||
[brown button] "Dang nhap"
|
||||
```
|
||||
|
||||
- Guest state (user = null)
|
||||
- Brown primary button
|
||||
- Click: toggles to next state
|
||||
|
||||
**State 2: Manager**
|
||||
|
||||
```
|
||||
[caramel/gold badge] "👔 Quản lý"
|
||||
```
|
||||
|
||||
- Shows manager role
|
||||
- Gold/caramel colored badge
|
||||
- User tie icon
|
||||
- Name: Nguyễn Văn An
|
||||
|
||||
**State 3: Staff**
|
||||
|
||||
```
|
||||
[border button] "👤 [Name]"
|
||||
```
|
||||
|
||||
- Shows staff role with avatar placeholder
|
||||
- Bordered button style
|
||||
- Name: Trần Thị Bình
|
||||
@@ -82,19 +88,21 @@ The header cycles through 3 auth states (for UI demo):
|
||||
|
||||
### Responsive Behavior
|
||||
|
||||
| Breakpoint | Layout |
|
||||
|-----------|--------|
|
||||
| < sm | Stacked vertically |
|
||||
| sm-md (640px) | Side-by-side, reduced spacing |
|
||||
| md+ (768px) | Full width, comfortable spacing |
|
||||
| Breakpoint | Layout |
|
||||
| ------------- | ------------------------------- |
|
||||
| < sm | Stacked vertically |
|
||||
| sm-md (640px) | Side-by-side, reduced spacing |
|
||||
| md+ (768px) | Full width, comfortable spacing |
|
||||
|
||||
**Mobile (<640px):**
|
||||
|
||||
- Logo smaller
|
||||
- Name only (no tagline)
|
||||
- Auth button text hidden, icon shown
|
||||
- Touch-friendly padding
|
||||
|
||||
**Desktop (≥640px):**
|
||||
|
||||
- Normal logo size
|
||||
- Full layout with tagline
|
||||
- Button with text and icon
|
||||
@@ -102,16 +110,16 @@ The header cycles through 3 auth states (for UI demo):
|
||||
|
||||
### Styling
|
||||
|
||||
| Element | Classes |
|
||||
|---------|---------|
|
||||
| Header wrapper | `sticky top-0 z-50 bg-white shadow-md` |
|
||||
| Container | `max-w-7xl mx-auto px-4 md:px-6 h-72px flex items-center` |
|
||||
| Left section (brand) | `flex items-center gap-3 flex-1` |
|
||||
| Right section (auth) | `flex items-center gap-3 shrink-0` |
|
||||
| Logo image | `w-10 h-10 md:w-12 md:h-12` |
|
||||
| Brand text | `font-bold text-sm md:text-base` |
|
||||
| Tagline | `hidden md:block text-xs text-muted-foreground` |
|
||||
| Auth button | `px-4 py-2 rounded-lg text-sm font-medium` |
|
||||
| Element | Classes |
|
||||
| -------------------- | --------------------------------------------------------- |
|
||||
| Header wrapper | `sticky top-0 z-50 bg-white shadow-md` |
|
||||
| Container | `max-w-7xl mx-auto px-4 md:px-6 h-72px flex items-center` |
|
||||
| Left section (brand) | `flex items-center gap-3 flex-1` |
|
||||
| Right section (auth) | `flex items-center gap-3 shrink-0` |
|
||||
| Logo image | `w-10 h-10 md:w-12 md:h-12` |
|
||||
| Brand text | `font-bold text-sm md:text-base` |
|
||||
| Tagline | `hidden md:block text-xs text-muted-foreground` |
|
||||
| Auth button | `px-4 py-2 rounded-lg text-sm font-medium` |
|
||||
|
||||
### CSS Variables Used
|
||||
|
||||
@@ -130,11 +138,13 @@ The header cycles through 3 auth states (for UI demo):
|
||||
- **next/link** - Navigation links
|
||||
- **lib/constants:** SHOP_INFO, MOCK_USERS
|
||||
- **lib/types:** User
|
||||
- **FontAwesome icons:** fa-sign-in-alt, fa-sign-out-alt, fa-user-tie, fa-user-circle
|
||||
- **FontAwesome icons:** fa-sign-in-alt, fa-sign-out-alt, fa-user-tie,
|
||||
fa-user-circle
|
||||
|
||||
### Key Code Snippets
|
||||
|
||||
**Auth Demo State Machine:**
|
||||
|
||||
```typescript
|
||||
const [user, setUser] = useState<User | null>(null);
|
||||
|
||||
@@ -150,6 +160,7 @@ const handleAuthClick = () => {
|
||||
```
|
||||
|
||||
**Responsive Brand Text:**
|
||||
|
||||
```typescript
|
||||
<div className="flex flex-col">
|
||||
<span className="font-bold text-sm md:text-base">{SHOP_INFO.name}</span>
|
||||
@@ -163,9 +174,9 @@ const handleAuthClick = () => {
|
||||
|
||||
## Footer (layouts/footer.tsx)
|
||||
|
||||
**File:** layouts/footer.tsx
|
||||
**Type:** Client component (uses constants)
|
||||
**Description:** Site footer with shop information, social links, and WiFi details.
|
||||
**File:** layouts/footer.tsx **Type:** Client component (uses constants)
|
||||
**Description:** Site footer with shop information, social links, and WiFi
|
||||
details.
|
||||
|
||||
### Layout
|
||||
|
||||
@@ -179,17 +190,18 @@ const handleAuthClick = () => {
|
||||
|
||||
**12-Column Grid Layout:**
|
||||
|
||||
| Breakpoint | Brand Info | Social + WiFi |
|
||||
|-----------|-----------|---------------|
|
||||
| Mobile | col-span-12 | col-span-12 |
|
||||
| md (768px) | col-span-6 | col-span-6 |
|
||||
| lg+ (1024px) | col-span-6 | col-span-6 |
|
||||
| Breakpoint | Brand Info | Social + WiFi |
|
||||
| ------------ | ----------- | ------------- |
|
||||
| Mobile | col-span-12 | col-span-12 |
|
||||
| md (768px) | col-span-6 | col-span-6 |
|
||||
| lg+ (1024px) | col-span-6 | col-span-6 |
|
||||
|
||||
### Sections
|
||||
|
||||
#### 1. Brand Info (Left Section)
|
||||
|
||||
**Content:**
|
||||
|
||||
- Shop logo (40x40px)
|
||||
- Shop name (bold)
|
||||
- Tagline (gray text)
|
||||
@@ -199,6 +211,7 @@ const handleAuthClick = () => {
|
||||
- Open hours with clock icon
|
||||
|
||||
**Responsive:**
|
||||
|
||||
```
|
||||
Mobile:
|
||||
└─ Logo
|
||||
@@ -216,11 +229,13 @@ Desktop:
|
||||
#### 2. Social Links (Top Right)
|
||||
|
||||
**Links:**
|
||||
|
||||
- Facebook icon → SHOP_INFO.facebook
|
||||
- TikTok icon → SHOP_INFO.tiktok
|
||||
- Website icon → SHOP_INFO.website
|
||||
|
||||
**Styling:**
|
||||
|
||||
- Icons in circle backgrounds
|
||||
- Hover effect (color change)
|
||||
- Flex row layout
|
||||
@@ -229,17 +244,20 @@ Desktop:
|
||||
#### 3. WiFi Card (Bottom Right)
|
||||
|
||||
**Content:**
|
||||
|
||||
- "📶 WiFi miễn phí" label
|
||||
- Network name (monospace)
|
||||
- Password (monospace, can be hidden/shown)
|
||||
|
||||
**Styling:**
|
||||
|
||||
- Light gray background
|
||||
- Rounded borders
|
||||
- Monospace font for credentials
|
||||
- Eye icon toggle for password visibility
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
📶 WiFi miễn phí
|
||||
┌────────────────────────┐
|
||||
@@ -252,11 +270,13 @@ Desktop:
|
||||
#### 4. Copyright Bar (Bottom)
|
||||
|
||||
**Content:**
|
||||
|
||||
- Copyright text: "© 2024 Coffee Shop"
|
||||
- "Made with ❤️ in Vietnam"
|
||||
- Centered
|
||||
|
||||
**Styling:**
|
||||
|
||||
- Small text
|
||||
- Gray color
|
||||
- Subtle separator line above
|
||||
@@ -264,35 +284,38 @@ Desktop:
|
||||
### Responsive Behavior
|
||||
|
||||
**Mobile (<768px):**
|
||||
|
||||
- Single column layout
|
||||
- Stacked sections
|
||||
- Full width
|
||||
- Padding around edges
|
||||
|
||||
**Tablet (768px):**
|
||||
|
||||
- 2-column layout
|
||||
- Brand info left, Social + WiFi right
|
||||
- Equal width columns
|
||||
|
||||
**Desktop (≥768px):**
|
||||
|
||||
- 2-column layout with more spacing
|
||||
- Brand info slightly smaller
|
||||
- Comfortable padding
|
||||
|
||||
### Styling
|
||||
|
||||
| Element | Classes |
|
||||
|---------|---------|
|
||||
| Footer wrapper | `bg-gray-100 border-t` |
|
||||
| Container | `max-w-7xl mx-auto px-4 py-8` |
|
||||
| Grid | `grid grid-cols-12 gap-8` |
|
||||
| Brand section | `col-span-12 md:col-span-6` |
|
||||
| Social section | `col-span-12 md:col-span-6` |
|
||||
| Logo | `w-10 h-10` |
|
||||
| Info text | `text-sm text-gray-600` |
|
||||
| Social icons | `w-10 h-10 rounded-full flex items-center justify-center` |
|
||||
| WiFi card | `bg-white p-4 rounded-lg border` |
|
||||
| Copyright bar | `border-t mt-8 pt-6 text-center text-xs text-gray-500` |
|
||||
| Element | Classes |
|
||||
| -------------- | --------------------------------------------------------- |
|
||||
| Footer wrapper | `bg-gray-100 border-t` |
|
||||
| Container | `max-w-7xl mx-auto px-4 py-8` |
|
||||
| Grid | `grid grid-cols-12 gap-8` |
|
||||
| Brand section | `col-span-12 md:col-span-6` |
|
||||
| Social section | `col-span-12 md:col-span-6` |
|
||||
| Logo | `w-10 h-10` |
|
||||
| Info text | `text-sm text-gray-600` |
|
||||
| Social icons | `w-10 h-10 rounded-full flex items-center justify-center` |
|
||||
| WiFi card | `bg-white p-4 rounded-lg border` |
|
||||
| Copyright bar | `border-t mt-8 pt-6 text-center text-xs text-gray-500` |
|
||||
|
||||
### CSS Variables Used
|
||||
|
||||
@@ -311,11 +334,13 @@ Desktop:
|
||||
- **next/image** - Shop logo
|
||||
- **next/link** - Social links
|
||||
- **lib/constants:** SHOP_INFO, SOCIAL_LINKS
|
||||
- **FontAwesome icons:** location-dot, phone, envelope, clock, facebook, tiktok, globe, wifi, eye, eye-slash
|
||||
- **FontAwesome icons:** location-dot, phone, envelope, clock, facebook, tiktok,
|
||||
globe, wifi, eye, eye-slash
|
||||
|
||||
### Key Code Snippets
|
||||
|
||||
**Brand Info Section:**
|
||||
|
||||
```typescript
|
||||
<div className="flex gap-4">
|
||||
<Image src={SHOP_INFO.logo} alt={SHOP_INFO.name} width={40} height={40} />
|
||||
@@ -329,6 +354,7 @@ Desktop:
|
||||
```
|
||||
|
||||
**Social Links:**
|
||||
|
||||
```typescript
|
||||
<div className="flex gap-3">
|
||||
<Link href={SOCIAL_LINKS.facebook} target="_blank" rel="noopener">
|
||||
@@ -339,6 +365,7 @@ Desktop:
|
||||
```
|
||||
|
||||
**WiFi Display:**
|
||||
|
||||
```typescript
|
||||
<div className="bg-white p-4 rounded-lg">
|
||||
<p className="font-semibold text-sm">📶 WiFi miễn phí</p>
|
||||
@@ -370,6 +397,7 @@ export default function RootLayout({ children }) {
|
||||
```
|
||||
|
||||
**Result:**
|
||||
|
||||
- Header: Always at top (sticky)
|
||||
- Content: Takes full width between header/footer
|
||||
- Footer: Always at bottom
|
||||
@@ -446,9 +474,7 @@ CSS variables are set up for dark mode support. To enable:
|
||||
2. Or use Tailwind dark class:
|
||||
|
||||
```html
|
||||
<div className="dark:bg-gray-900 dark:text-white">
|
||||
Content
|
||||
</div>
|
||||
<div className="dark:bg-gray-900 dark:text-white">Content</div>
|
||||
```
|
||||
|
||||
---
|
||||
@@ -456,18 +482,21 @@ CSS variables are set up for dark mode support. To enable:
|
||||
## Accessibility
|
||||
|
||||
### Header
|
||||
|
||||
- Logo has alt text
|
||||
- Auth button has aria-label
|
||||
- Icons have semantic meaning
|
||||
- Good contrast ratios
|
||||
|
||||
### Footer
|
||||
|
||||
- Headings use semantic tags
|
||||
- Links have descriptive text
|
||||
- Icons are decorative (aria-hidden)
|
||||
- Monospace font for technical info (WiFi credentials)
|
||||
|
||||
### General
|
||||
|
||||
- Touch targets ≥ 48px on mobile
|
||||
- Sufficient color contrast
|
||||
- Semantic HTML structure
|
||||
|
||||
Reference in New Issue
Block a user