|
1 |
| -# Bottom Navigation Component |
| 1 | +# BottomNav Component |
2 | 2 |
|
3 |
| -A responsive bottom navigation bar component for the Champion Trader application that provides primary navigation on mobile devices. |
| 3 | +A mobile-first navigation component that provides easy access to primary application features through a bottom navigation bar. |
4 | 4 |
|
5 |
| -## Overview |
| 5 | +## Features |
6 | 6 |
|
7 |
| -The Bottom Navigation component implements a mobile-first navigation interface that adapts based on the user's authentication status and device type. It follows atomic component design principles and is implemented using Test-Driven Development (TDD). |
| 7 | +- Mobile-optimized navigation |
| 8 | +- Icon and label display |
| 9 | +- Active route indication |
| 10 | +- Badge support |
| 11 | +- Smooth transitions |
| 12 | +- Touch-friendly design |
8 | 13 |
|
9 | 14 | ## Component Structure
|
10 | 15 |
|
11 | 16 | ```
|
12 | 17 | BottomNav/
|
13 | 18 | ├── BottomNav.tsx # Main component
|
14 |
| -├── index.ts # Public exports |
15 |
| -└── __tests__/ # Test suite |
16 |
| - └── BottomNav.test.tsx |
| 19 | +├── index.ts # Exports |
| 20 | +└── README.md # This file |
17 | 21 | ```
|
18 | 22 |
|
19 | 23 | ## Usage
|
20 | 24 |
|
21 |
| -```typescript |
| 25 | +```tsx |
22 | 26 | import { BottomNav } from '@/components/BottomNav';
|
23 | 27 |
|
24 |
| -function App() { |
| 28 | +function MobileLayout() { |
25 | 29 | return (
|
26 |
| - <div> |
27 |
| - <main>{/* Main content */}</main> |
| 30 | + <div className="mobile-layout"> |
| 31 | + <main>{/* Content */}</main> |
28 | 32 | <BottomNav />
|
29 | 33 | </div>
|
30 | 34 | );
|
31 | 35 | }
|
32 | 36 | ```
|
33 | 37 |
|
34 |
| -## Features |
35 |
| - |
36 |
| -- Responsive mobile-first design |
37 |
| -- Authentication-aware navigation |
38 |
| -- Smooth transitions and animations |
39 |
| -- Active route highlighting |
40 |
| -- Device-type specific rendering |
| 38 | +## Props |
41 | 39 |
|
42 |
| -## Implementation Details |
| 40 | +| Prop | Type | Description | |
| 41 | +|------|------|-------------| |
| 42 | +| className? | string | Optional CSS classes | |
| 43 | +| items? | NavItem[] | Optional custom navigation items | |
43 | 44 |
|
44 |
| -The component follows atomic design principles: |
45 |
| -- Self-contained navigation logic |
46 |
| -- Independent state management |
47 |
| -- Clear prop interfaces |
48 |
| -- Comprehensive test coverage |
49 |
| - |
50 |
| -### State Management |
51 |
| - |
52 |
| -The component manages: |
53 |
| -- Authentication state via clientStore |
54 |
| -- Active route state |
55 |
| -- Device type detection |
56 |
| -- Navigation state |
57 |
| - |
58 |
| -### Navigation Items |
59 |
| - |
60 |
| -Navigation items are conditionally rendered based on authentication status: |
| 45 | +## Types |
61 | 46 |
|
62 | 47 | ```typescript
|
63 | 48 | interface NavItem {
|
64 | 49 | label: string;
|
65 |
| - icon: React.ReactNode; |
| 50 | + icon: IconComponent; |
66 | 51 | path: string;
|
67 |
| - requiresAuth: boolean; |
| 52 | + badge?: number | string; |
68 | 53 | }
|
69 | 54 | ```
|
70 | 55 |
|
71 |
| -## Testing |
| 56 | +## Features |
72 | 57 |
|
73 |
| -The component includes comprehensive tests following TDD methodology: |
74 |
| -- Unit tests for navigation logic |
75 |
| -- Authentication state tests |
76 |
| -- Device type rendering tests |
77 |
| -- Route handling tests |
78 |
| -- Transition animation tests |
| 58 | +### Navigation Items |
| 59 | +- Icon representation |
| 60 | +- Text labels |
| 61 | +- Active state |
| 62 | +- Optional badges |
| 63 | +- Touch targets |
| 64 | + |
| 65 | +### Interactions |
| 66 | +- Touch feedback |
| 67 | +- Active highlighting |
| 68 | +- Route transitions |
| 69 | +- Badge updates |
| 70 | + |
| 71 | +### Responsive Behavior |
| 72 | +- Portrait/Landscape handling |
| 73 | +- Safe area support |
| 74 | +- Keyboard awareness |
| 75 | +- Gesture handling |
| 76 | + |
| 77 | +## Styling |
| 78 | + |
| 79 | +The component uses TailwindCSS for styling: |
| 80 | +- Mobile-first design |
| 81 | +- Touch-friendly sizing |
| 82 | +- Active states |
| 83 | +- Badge styling |
| 84 | +- iOS/Android adaptations |
| 85 | + |
| 86 | +## State Management |
| 87 | + |
| 88 | +The component integrates with: |
| 89 | +- Route management |
| 90 | +- Badge updates |
| 91 | +- Device orientation |
| 92 | +- Keyboard visibility |
79 | 93 |
|
80 | 94 | ## Best Practices
|
81 | 95 |
|
82 |
| -- Uses TailwindCSS for consistent styling |
83 |
| -- Implements proper cleanup for event listeners |
84 |
| -- Handles all authentication states |
85 |
| -- Provides clear visual feedback |
86 |
| -- Maintains accessibility standards |
87 |
| -- Supports keyboard navigation |
88 |
| - |
89 |
| -## Responsive Design |
90 |
| - |
91 |
| -The component implements responsive behavior: |
92 |
| -- Full-width on mobile devices |
93 |
| -- Hidden on desktop (uses side navigation instead) |
94 |
| -- Adapts to device orientation changes |
95 |
| -- Handles safe area insets on mobile devices |
| 96 | +1. Use clear, recognizable icons |
| 97 | +2. Keep labels short and clear |
| 98 | +3. Ensure adequate touch targets |
| 99 | +4. Handle safe areas properly |
| 100 | +5. Follow atomic design principles |
| 101 | +6. Maintain test coverage |
| 102 | + |
| 103 | +## Accessibility |
| 104 | + |
| 105 | +The component implements: |
| 106 | +- ARIA roles |
| 107 | +- Touch targets |
| 108 | +- Focus indicators |
| 109 | +- Screen reader support |
| 110 | +- High contrast modes |
| 111 | + |
| 112 | +## Platform Considerations |
| 113 | + |
| 114 | +### iOS |
| 115 | +- Safe area insets |
| 116 | +- Bottom sheet interaction |
| 117 | +- Gesture handling |
| 118 | +- Native-like feel |
| 119 | + |
| 120 | +### Android |
| 121 | +- Material Design alignment |
| 122 | +- Back button handling |
| 123 | +- Navigation patterns |
| 124 | +- System UI integration |
| 125 | + |
| 126 | +## Related Components |
| 127 | + |
| 128 | +- SideNav: Desktop navigation |
| 129 | +- MenuSidebar: Expanded menu |
| 130 | +- Header: Top navigation |
| 131 | +- PositionsSidebar: Trading panel |
0 commit comments