From 1b8d4f4a2f3437fd9e463f584e9facb1899f5beb Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 10 Jan 2026 09:24:39 +0000 Subject: [PATCH] drover: task-1767765269702426639 Task: Create mobile design guidelines --- docs/README.md | 3 +- docs/components/mobile-design-guidelines.md | 821 ++++++++++++++++++++ examples/mobile-first-demo/src/lib.rs | 92 +++ 3 files changed, 915 insertions(+), 1 deletion(-) create mode 100644 docs/components/mobile-design-guidelines.md create mode 100644 examples/mobile-first-demo/src/lib.rs diff --git a/docs/README.md b/docs/README.md index eade700..b4d498a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -18,12 +18,13 @@ Deep dive into the technical design: - [Coverage Analysis](./architecture/coverage/) - Test coverage documentation - [Performance Analysis](./architecture/performance/) - Performance benchmarks and optimization -### 🧩 [Components](./components/README.md) +### 🧩 [Components](./components/) Component library reference: - [API Reference](./components/api-reference/) - [Examples](./components/examples/) - [Accessibility Guide](./components/accessibility/) - [Theming Guide](./components/theming/) +- [Mobile Design Guidelines](./components/mobile-design-guidelines.md) - Responsive design patterns and best practices ### 🎓 [Tutorials](./tutorials/README.md) Step-by-step video and written tutorials: diff --git a/docs/components/mobile-design-guidelines.md b/docs/components/mobile-design-guidelines.md new file mode 100644 index 0000000..e3709e1 --- /dev/null +++ b/docs/components/mobile-design-guidelines.md @@ -0,0 +1,821 @@ +# Mobile Design Guidelines + +This guide documents the mobile-first design patterns and responsive design principles used throughout the Leptos ShadCN UI component library. + +## Table of Contents + +- [Overview](#overview) +- [Design Philosophy](#design-philosophy) +- [Breakpoint System](#breakpoint-system) +- [Core Patterns](#core-patterns) +- [Component-Specific Guidelines](#component-specific-guidelines) +- [Layout Patterns](#layout-patterns) +- [Typography](#typography) +- [Spacing](#spacing) +- [Touch Targets](#touch-targets) +- [Performance Considerations](#performance-considerations) +- [Testing Responsive Designs](#testing-responsive-designs) +- [Examples](#examples) + +## Overview + +Leptos ShadCN UI follows a **mobile-first** approach using Tailwind CSS's responsive utility classes. All components are designed to work seamlessly on mobile devices (320px+) and progressively enhance for larger screens. + +### Key Principles + +1. **Mobile First**: Start with mobile layouts, enhance for larger screens +2. **Touch Friendly**: All interactive elements meet minimum touch target sizes +3. **Progressive Enhancement**: Add complexity only when screen real estate allows +4. **Performance First**: Optimize for mobile network conditions and device constraints +5. **Accessible**: Maintain WCAG 2.1 AA compliance across all viewport sizes + +## Design Philosophy + +### Mobile-First Approach + +We design for the smallest screen first, then add complexity for larger screens. This ensures: + +- Core functionality works on all devices +- Performance is optimized for mobile constraints +- Content is prioritized over decoration +- Progressive enhancement is natural + +### Responsive Breakpoints + +Our breakpoint system aligns with common device sizes: + +| Breakpoint | Min Width | Target Devices | Use Case | +|------------|-----------|----------------|----------| +| (default) | 0px | Mobile phones | Base styles, single column layouts | +| `sm:` | 640px | Large phones, landscape | Two-column grids, enhanced spacing | +| `md:` | 768px | Tablets | Multi-column layouts, sidebars | +| `lg:` | 1024px | Laptops, small desktops | Full navigation, complex grids | +| `xl:` | 1280px | Desktops | Maximum content width, 4+ columns | +| `2xl:` | 1536px | Large desktops | Maximum layout width | + +## Breakpoint System + +### Default Configuration + +```javascript +// tailwind.config.js +theme: { + screens: { + 'sm': '640px', + 'md': '768px', + 'lg': '1024px', + 'xl': '1280px', + '2xl': '1536px', + } +} +``` + +### Usage Pattern + +Always write mobile styles first (no prefix), then enhance: + +```rust +// ✅ CORRECT: Mobile-first +
+ +// ❌ WRONG: Desktop-first thinking +
+``` + +## Core Patterns + +### 1. Responsive Grids + +The most common pattern for responsive layouts: + +```rust +// Single column mobile, 2 columns tablet, 3-4 columns desktop +
+``` + +#### Examples by Use Case + +**Card Grids** (components/api/card.md:189): +```rust +
+ // Card components +
+``` + +**Feature Sections** (comprehensive_demo.rs:156): +```rust +
+ // Feature items +
+``` + +**Dashboard Layouts** (dashboard-demo/src/lib.rs:195): +```rust +
+ // Stats cards +
+``` + +### 2. Responsive Spacing + +Adjust padding and margins based on screen size: + +```rust +// Minimal padding on mobile, more on larger screens +
+ +// Spacing between sections +
+``` + +### 3. Responsive Typography + +Scale text size appropriately: + +```rust +// Headings +

+

+ +// Body text +

+``` + +### 4. Hiding/Showing Content + +Conditionally display elements by screen size: + +```rust +// Mobile-only elements +

+ +// Tablet and desktop only +