Skip to content

Commit cb7fc54

Browse files
author
ManishM
committed
The UI/UX design guidelines
1 parent fe074b7 commit cb7fc54

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

prompts/frameworks/cakephp.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,102 @@ Use these Claude Code capabilities at the right time to save effort and catch mi
506506

507507
---
508508

509+
## Mobile-First UI/UX Design Guidelines
510+
511+
> These guidelines are for building CakePHP template UIs used by **non-technical users on mobile phones with slow mobile networks**.
512+
513+
### Navigation
514+
515+
1. **Icon-only arrow buttons for prev/next** — Never use text like "Previous" or "Next". Use `<i class="bi bi-chevron-left"></i>` and `<i class="bi bi-chevron-right"></i>` inside `btn btn-sm btn-outline-secondary`. Saves horizontal space on mobile.
516+
517+
2. **Week navigation pattern:**
518+
```php
519+
<div class="d-flex justify-content-between align-items-center">
520+
<a href="?week=<?= $prevWeek ?>" class="btn btn-sm btn-outline-secondary"><i class="bi bi-chevron-left"></i></a>
521+
<strong style="font-size:0.9rem;"><?= $weekStart->format('d M') ?> — <?= $weekEnd->format('d M Y') ?></strong>
522+
<a href="?week=<?= $nextWeek ?>" class="btn btn-sm btn-outline-secondary"><i class="bi bi-chevron-right"></i></a>
523+
</div>
524+
```
525+
526+
3. **Month navigation pattern:**
527+
```php
528+
<a href="?month=<?= $prevMonth ?>"><i class="bi bi-chevron-left"></i> <?= $prevMonthName ?></a>
529+
<strong><?= $monthStart->format('F Y') ?></strong>
530+
<a href="?month=<?= $nextMonth ?>"><?= $nextMonthName ?> <i class="bi bi-chevron-right"></i></a>
531+
```
532+
Month nav can include short month name next to the arrow (e.g., "Feb >") since there's more space than week labels.
533+
534+
4. **"This Week" / "Current Month" button** — Only show when user has navigated away from current period. Hide when already on current period.
535+
536+
5. **Preserve filters when navigating** — Carry forward active filters (e.g., category, user_id) via query parameters in prev/next links.
537+
538+
### Tables & Data Display
539+
540+
6. **No horizontal scrolling on mobile** — Show only essential columns (Name, ID, Total) in the main table. Put detailed/day-by-day data in a **modal popup** triggered by clicking the summary value.
541+
542+
7. **Clickable totals for detail drilldown** — Summary numbers (e.g., totals, counts) should be clickable links that open a modal. Style: `text-primary font-weight-bold` with underline.
543+
544+
8. **Modal for detail views** — Use `modal-dialog-centered modal-dialog-scrollable`. Layout:
545+
- **Info card** — Name, ID
546+
- **Summary card** — Key metrics in horizontal row (`d-flex justify-content-around text-center`)
547+
- **Detail table** — Full breakdown (date, category, status)
548+
- **Link to full page** — "View Full Report" button to the dedicated detail page
549+
550+
9. **Skip modal tables for auto-download** — When auto-detecting tables for Excel export, use `table:not(.modal table)` selector so hidden modal tables don't get download buttons.
551+
552+
10. **Fractional totals** — When items have partial values (e.g., Full = 1, Half = 0.5), display as integer when whole (e.g., "3"), decimal when not (e.g., "2.5").
553+
554+
### Mobile-First Patterns
555+
556+
11. **Card-based layouts over table rows** — For primary interaction screens (e.g., status marking, data entry), use cards with large touch targets. Colored left border indicates status (`border-left: 4px solid #28a745`).
557+
558+
12. **Sticky filters on mobile** — Filter bars should be `position: sticky; top: 70px; z-index: 100; background: white;` so they stay visible while scrolling.
559+
560+
13. **Fixed bottom action buttons on mobile:**
561+
```css
562+
@media (max-width: 576px) {
563+
.save-container {
564+
position: fixed; bottom: 0; left: 0; right: 0;
565+
padding: 10px 15px; background: white;
566+
box-shadow: 0 -2px 10px rgba(0,0,0,0.1); z-index: 100;
567+
}
568+
}
569+
```
570+
571+
14. **Large touch targets** — Action buttons: `padding: 10px 4px` minimum on mobile. Use `flex: 1` so buttons fill width equally.
572+
573+
15. **Stat cards in 2-column grid**Use `col-6 col-md-3` for 2x2 on mobile, 4-column on desktop. Large number + small label.
574+
575+
### Interaction & Feedback
576+
577+
16. **Double-tap prevention** — Disable submit buttons after first tap, show spinner:
578+
```javascript
579+
btn.disabled = true;
580+
btn.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Saving...';
581+
```
582+
583+
17. **Loading overlay** — Full-screen semi-transparent overlay with centered spinner during form submissions.
584+
585+
18. **Toast notifications for AJAX** — Temporary `alert` banners (`position-fixed; top:15px; right:15px; z-index:9999;`) that auto-dismiss after 4 seconds.
586+
587+
19. **Consistent color coding:**
588+
- Green (`text-success`, `badge-success`, `btn-success`) = Positive / Complete / Active
589+
- Yellow/Orange (`text-warning`, `badge-warning`, `btn-warning`) = Partial / Pending
590+
- Red (`text-danger`, `badge-danger`, `btn-danger`) = Negative / Missing / Inactive
591+
- Blue (`text-primary`) = Totals / Neutral highlights
592+
593+
20. **Confirmation for destructive actions** — `confirm()` before remove/delete. Show spinner on the button during AJAX call.
594+
595+
### Component Patterns
596+
597+
21. **AJAX search with dropdown**Text input + `position-absolute` `list-group` dropdown. Debounce 300ms. "No results" message. Close on outside click.
598+
599+
22. **Bulk action buttons** — Row of action buttons above a list for quick bulk operations. Use `flex-fill` so they share width equally.
600+
601+
23. **Date input constraints** — When date picker operates within a specific range (e.g., a week), set `min` and `max` attributes to constrain selection.
602+
603+
24. **Page heading element**Use `ele_page_heading` element. Pass `downloadTableButton => true` for auto Excel download buttons.
604+
509605
---
510606

511607
## Self-Doubt Checklist

0 commit comments

Comments
 (0)