|
1 | 1 | # ContextMenu Component
|
2 | 2 |
|
3 |
| -This directory contains a refactored version of the ContextMenu component for the Quran reader application. |
| 3 | +This directory contains the refactored version of the ContextMenu component for the Quran reader application. |
4 | 4 |
|
5 | 5 | ## Structure
|
6 | 6 |
|
7 | 7 | The component has been refactored into a more maintainable and scalable structure:
|
8 | 8 |
|
9 | 9 | ```
|
10 | 10 | ContextMenu/
|
11 |
| -├── components/ # Individual UI components |
12 |
| -│ ├── ChapterNavigation.tsx # Chapter name and sidebar toggle |
13 |
| -│ └── PageInfo.tsx # Juz, Hizb, and Page information |
14 |
| -├── hooks/ # Custom hooks for state management |
15 |
| -│ └── useContextMenuState.ts # Centralized state management |
16 |
| -├── styles/ # Styles for the component |
17 |
| -│ └── ContextMenu.module.scss # Styles (moved from parent directory) |
18 |
| -├── index.tsx # Main component that composes everything |
19 |
| -└── README.md # Documentation |
| 11 | +├── components/ # Individual UI components |
| 12 | +│ ├── ChapterNavigation.tsx # Chapter name and sidebar toggle |
| 13 | +│ ├── MobileReadingTabs.tsx # Mobile-specific reading tabs |
| 14 | +│ ├── PageBookmarkAction.tsx # Bookmark functionality |
| 15 | +│ ├── PageInfo.tsx # Juz, Hizb, and Page information |
| 16 | +│ ├── ProgressBar.tsx # Reading progress visualization |
| 17 | +│ └── styles/ # Component-specific styles |
| 18 | +├── hooks/ # Custom hooks for state management |
| 19 | +│ └── useContextMenuState.ts # Centralized state management |
| 20 | +├── styles/ # Styles for the component |
| 21 | +│ └── ContextMenu.module.scss # Main styles |
| 22 | +├── index.tsx # Main component that composes everything |
| 23 | +└── README.md # Documentation |
20 | 24 | ```
|
21 | 25 |
|
22 | 26 | ## Improvements
|
23 | 27 |
|
24 | 28 | 1. **Separation of Concerns**:
|
25 | 29 | - UI components are separated from state management
|
26 | 30 | - Each component has a single responsibility
|
| 31 | + - Mobile and desktop experiences are handled separately |
27 | 32 |
|
28 | 33 | 2. **Improved Accessibility**:
|
29 | 34 | - Fixed accessibility issues with proper keyboard navigation
|
30 | 35 | - Added proper ARIA roles for interactive elements
|
| 36 | + - Enhanced focus management for interactive components |
31 | 37 |
|
32 | 38 | 3. **Maintainability**:
|
33 | 39 | - Smaller, focused components are easier to understand and modify
|
34 | 40 | - State management is centralized in a custom hook
|
| 41 | + - Responsive behavior is clearly separated |
35 | 42 |
|
36 | 43 | 4. **Scalability**:
|
37 | 44 | - New features can be added by creating new components
|
38 | 45 | - State management is isolated and can be extended easily
|
| 46 | + - Responsive design patterns are established for future components |
39 | 47 |
|
40 | 48 | 5. **Readability**:
|
41 | 49 | - Clear component naming and organization
|
42 | 50 | - Consistent code style and patterns
|
| 51 | + - Well-documented component responsibilities |
| 52 | + |
| 53 | +## Features |
| 54 | + |
| 55 | +- **Chapter Navigation**: Toggle sidebar and display current chapter |
| 56 | +- **Page Information**: Display Juz, Hizb, and Page numbers |
| 57 | +- **Reading Preferences**: Switch between different reading modes |
| 58 | +- **Progress Tracking**: Visual indicator of reading progress |
| 59 | +- **Mobile Optimization**: Specialized components for mobile experience |
| 60 | +- **Responsive Layout**: Adapts to different screen sizes and orientations |
43 | 61 |
|
44 | 62 | ## Usage
|
45 | 63 |
|
|
0 commit comments