@longtq2501/next-spring-skills 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +8 -0
  2. package/package.json +1 -1
  3. package/skills/SKILL.md +24 -0
  4. package/skills/debug-and-fix.md +64 -0
  5. package/skills/nextjs/component-aesthetics.md +58 -0
  6. package/skills/nextjs/design-intelligence.md +76 -0
  7. package/skills/nextjs/design-tokens.md +68 -0
  8. package/skills/nextjs/performance.md +11 -0
  9. package/skills/nextjs/premium-effects.md +61 -0
  10. package/skills/nextjs/premium-inputs.md +65 -0
  11. package/skills/nextjs/responsive-design.md +56 -0
  12. package/skills/nextjs/testing.md +74 -70
  13. package/skills/nextjs/ui-libraries.md +12 -5
  14. package/skills/nextjs/ux-feedback.md +56 -0
  15. package/skills/spring/query_optimization.md +1 -0
  16. package/skills/spring/repository_design.md +7 -4
  17. package/skills/spring/service_design.md +23 -3
  18. package/skills/ui-ux-pro-max/SKILL.md +292 -0
  19. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  20. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  21. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  22. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  23. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  24. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  25. package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  26. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  27. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  28. package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  29. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  30. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  31. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  32. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  33. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  34. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  35. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  36. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  37. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  38. package/skills/ui-ux-pro-max/data/styles.csv +68 -0
  39. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  40. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  41. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  42. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  43. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
  44. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
  45. package/skills/ui-ux-pro-max/scripts/__pycache__/search.cpython-314.pyc +0 -0
  46. package/skills/ui-ux-pro-max/scripts/core.py +253 -0
  47. package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  48. package/skills/ui-ux-pro-max/scripts/search.py +114 -0
package/README.md CHANGED
@@ -27,6 +27,14 @@ npx @longtq2501/next-spring-skills
27
27
 
28
28
  This will copy the `skills/` directory and `AGENT.md` into your current project folder.
29
29
 
30
+ Meta-Prompt:
31
+
32
+ > "Triển khai [Task của bạn] theo chuẩn Design Intelligence + Next.js Performance."
33
+
34
+ > "Triển khai [Backend Task] theo chuẩn Spring Boot Pro Max (Performance & Clean Code)."
35
+
36
+ > "Sửa lỗi [Mô tả lỗi] theo chuẩn Debug & Fix Pro Max."
37
+
30
38
  ## Workflow
31
39
 
32
40
  This repository is designed for **AI-Human Collaboration**. For every new task:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longtq2501/next-spring-skills",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Standardized best practices and code patterns for Next.js and Spring Boot",
5
5
  "bin": {
6
6
  "next-spring-skills": "bin/cli.js"
package/skills/SKILL.md CHANGED
@@ -92,6 +92,30 @@ See [performance.md](./nextjs/performance.md) for React optimization and data fe
92
92
 
93
93
  ---
94
94
 
95
+ ## Design Intelligence (Pro Max)
96
+
97
+ Standardized design systems, color palettes, and UX guidelines.
98
+
99
+ ### Core Database
100
+ See [SKILL.md](./ui-ux-pro-max/SKILL.md) for styles, palettes, and font pairings.
101
+
102
+ ### Next.js Integration
103
+ See [design-intelligence.md](./nextjs/design-intelligence.md) for mapping design to high-performance code.
104
+
105
+ ---
106
+
107
+ ## Troubleshooting & Debugging (Pro Max)
108
+
109
+ Systematic workflows for identifying and fixing complex issues.
110
+
111
+ ### Unified Workflow
112
+ See [debug-and-fix.md](./debug-and-fix.md) for the 5-step debugging process (Observation → Verification).
113
+
114
+ ### Next.js Debug Tricks
115
+ See [debug-tricks.md](./nextjs/debug-tricks.md) for `nezt/mcp` and build path debugging.
116
+
117
+ ---
118
+
95
119
  ## AI Agent Workflow
96
120
 
97
121
  ### Interaction Protocol
@@ -0,0 +1,64 @@
1
+ # Skill: Debug & Fix (Pro Max Standards)
2
+
3
+ Systematic workflow for identifying root causes and applying high-performance fixes across Next.js and Spring Boot.
4
+
5
+ ## 1. The Pro Max Debugging Workflow
6
+
7
+ Follow these 5 steps for ANY issue (Bug, Performance, or UX):
8
+
9
+ ### Step 1: Observation & Data Collection
10
+ - **Frontend**: Check Browser Console, Network Tab, and `next-development.log`.
11
+ - **Backend**: Check Spring Boot logs (`log.info/error`) and Hibernate SQL output.
12
+ - **Tools**: Use `curl -X POST /_next/mcp` to get real-time dev server errors.
13
+
14
+ ### Step 2: Hypothesis Generation
15
+ Based on the data, identify the most likely layer of failure:
16
+ - **UI/UX**: Component state, Tailwind classes, or React lifecycle.
17
+ - **Logic**: Frontend hooks or Backend Service implementation.
18
+ - **Performance**: DB Query (N+1), heavy JS bundle, or inefficient re-renders.
19
+
20
+ ### Step 3: Isolation & Reproduction
21
+ - **Bisect**: Comment out components/logic to find the exact line causing the crash.
22
+ - **Repro**: Define the exact sequence of user actions that triggers the issue.
23
+ - **Mock**: Use `MockMVC` (Backend) or `Vitest` (Frontend) to isolate the unit.
24
+
25
+ ### Step 4: Resolution (Clean Fix)
26
+ Apply the fix according to project standards:
27
+ - **Frontend**: Use `useMemo`, `useCallback`, or `next/image`.
28
+ - **Backend**: Use proper Enum comparison (`==`), custom exceptions, and DB-level filtering.
29
+ - **Refactor**: If the fix introduces complexity, refactor surrounding code to maintain readability.
30
+
31
+ ### Step 5: Verification & Documentation
32
+ - **Verify**: Test the fix across different viewports and states.
33
+ - **Update Ledger**: Update `ISSUES.md` (Archive) with root cause and impact.
34
+ - **Regression**: Ensure no other features were broken.
35
+
36
+ ---
37
+
38
+ ## 2. Standard Issue Categories
39
+
40
+ | Category | Priority | Lead Indicator | Standard Action |
41
+ |----------|----------|----------------|-----------------|
42
+ | **Performance** | P0/P1 | LCP > 2.5s / API > 2s | `query_optimization.md` / `performance.md` |
43
+ | **Logic/Bug** | P0/P1 | 500 Error / Crash | `error_handling_design.md` / `debug-tricks.md` |
44
+ | **UX/UI** | P2/P3 | Visual glitch / Delay | `ux-feedback.md` / `design-intelligence.md` |
45
+
46
+ ---
47
+
48
+ ## 3. Universal Trigger Prompt
49
+
50
+ To trigger this workflow for a specific issue, use:
51
+
52
+ > **"Sửa lỗi [Mô tả lỗi] theo chuẩn Debug & Fix Pro Max."**
53
+
54
+ **What this triggers in me:**
55
+ 1. **Log Analysis**: I will proactively look for logs/errors in the workspace.
56
+ 2. **Systematic Plan**: I will update `ISSUES.md` and propose a scoped fix.
57
+ 3. **Verified Execution**: I will implement the fix and verify it before delivery.
58
+
59
+ ---
60
+
61
+ ## Related Skills
62
+ - **Agent Workflow**: `skills/agent-workflow.md` (Ledger management)
63
+ - **Debug Tricks**: `skills/nextjs/debug-tricks.md` (Next.js specific tools)
64
+ - **Performance**: `skills/nextjs/performance.md` & `skills/spring/performance_optimization.md`
@@ -0,0 +1,58 @@
1
+ # Component Aesthetics
2
+
3
+ Standardizing the "feel" of components like cards, buttons, and sections ensures a premium, cohesive user experience.
4
+
5
+ ## 1. The 8px Spacing System
6
+
7
+ A consistent spacing system is the foundation of professional-looking UI. Always use multiples of 8px (or 4px for fine-tuning).
8
+
9
+ - **Nano**: `4px` (`p-1`, `m-1`) - Micro-spacing for icons/text.
10
+ - **Small**: `8px` (`p-2`, `m-2`) - Default gap for small items.
11
+ - **Base**: `16px` (`p-4`, `m-4`) - Standard padding for cards/modals.
12
+ - **Large**: `24px` (`p-6`, `m-6`) - Generous padding for landing sections.
13
+ - **Huge**: `32px` (`p-8`, `m-8`) - Container margins.
14
+
15
+ > [!TIP]
16
+ > Use `gap-{n}` instead of margins whenever possible to keep layout logic centralized in the container.
17
+
18
+ ## 2. Border Radius Scale
19
+
20
+ Consistent rounded corners make the UI feel modern and approachable. Avoid "sharp" 0px corners or "clipping" 2px corners.
21
+
22
+ - **Soft (md)**: `6px` / `0.375rem` - Checkboxes, small inputs.
23
+ - **Standard (lg)**: `8px` / `0.5rem` - Default button radius.
24
+ - **Premium (xl)**: `12px` / `0.75rem` - Cards, dropdown menus.
25
+ - **Super (2xl)**: `16px` / `1rem` - Large modals, image containers.
26
+ - **Full**: `9999px` - Pills, circular avatars.
27
+
28
+ ## 3. Shadow & Depth (Elevation)
29
+
30
+ Shadows should be subtle and multi-layered. Avoid single, dark, blurry shadows.
31
+
32
+ ```css
33
+ /* Custom utility for Premium Shadow */
34
+ .shadow-premium {
35
+ box-shadow:
36
+ 0 1px 2px rgba(0, 0, 0, 0.05),
37
+ 0 4px 6px -1px rgba(0, 0, 0, 0.1),
38
+ 0 2px 4px -1px rgba(0, 0, 0, 0.06);
39
+ }
40
+
41
+ /* Glassmorphism Border (Adds depth without heavy shadows) */
42
+ .border-premium {
43
+ border: 1px solid hsl(var(--border) / 0.5);
44
+ background-clip: padding-box;
45
+ }
46
+ ```
47
+
48
+ ## 4. Visual Hierarchy Techniques
49
+
50
+ - **Surface Contrast**: In dark mode, nested components should be *lighter* than their parents to simulate light reflection.
51
+ - Body Background: `hsl(240 10% 3.9%)`
52
+ - Card/Overlay: `hsl(240 10% 7.5%)`
53
+ - **Ghost Dividers**: Instead of solid lines, use `border-muted/30` or just whitespace (`gap`) to separate content.
54
+
55
+ ## Best Practices
56
+ 1. **Consistency is King**: If one card has `rounded-xl`, all equivalent cards must have `rounded-xl`.
57
+ 2. **Inner Radius Logic**: If a parent has `rounded-xl` (12px), the child should have `rounded-lg` (8px) to maintain a concentric look.
58
+ 3. **Subtle Borders**: Never use `#eee` or `black` for borders. Use `hsl(var(--border))` with varying opacities.
@@ -0,0 +1,76 @@
1
+ # Skill: Design Intelligence (Next.js 15 + UI/UX Pro Max)
2
+
3
+ Bridge the gap between pure design logic and high-performance Next.js implementation.
4
+
5
+ ## 1. The Design Workflow
6
+
7
+ When building a new feature or page, follow this hierarchical retrieval pattern:
8
+
9
+ 1. **Analyze**: Extract product type and style keywords from the request.
10
+ 2. **Generate**: Run the design system generator (use `--design-system`).
11
+ 3. **Integrate**: Map the generated variables to shadcn/ui or Tailwind tokens.
12
+
13
+ ### Generator Command
14
+ ```bash
15
+ python3 skills/ui-ux-pro-max/scripts/search.py "<product_type> <keywords>" --design-system
16
+ ```
17
+
18
+ ---
19
+
20
+ ## 2. Integrated Implementation Patterns
21
+
22
+ ### Mapping to shadcn/ui
23
+ Generated design system variables should be mapped to `globals.css` to respect the high-performance theming engine of shadcn.
24
+
25
+ // Bad: Hardcoding values in components
26
+ <div style={{ backgroundColor: '#0080FF' }}>...</div>
27
+
28
+ // Good: Map to CSS variables
29
+ // globals.css
30
+ :root {
31
+ --primary: 221.2 83.2% 53.3%; /* From generated palette */
32
+ --radius: 0.75rem; /* From generated style */
33
+ }
34
+
35
+ ### Performance-Aware Effects
36
+ High-end effects must use Next.js optimized patterns to maintain 60FPS.
37
+
38
+ | Style | Next.js Implementation Detail |
39
+ |-------|-------------------------------|
40
+ | **Glassmorphism** | Use `backdrop-blur` sparingly. Prefer `bg-white/80` in light mode for contrast. |
41
+ | **Parallax** | Use `will-change: transform` and Framer Motion's `useScroll`. |
42
+ | **Dark Mode** | Use `next-themes` to prevent hydration mismatch. |
43
+
44
+ ---
45
+
46
+ ## 3. Tooling & Automation
47
+
48
+ ### Automated Design System (Hierarchical)
49
+ Always use the `--persist` flag when starting a project to create a `MASTER.md` file.
50
+
51
+ ```bash
52
+ python3 skills/ui-ux-pro-max/scripts/search.py "fintech dashboard glassmorphism" --design-system --persist -p "BankPro"
53
+ ```
54
+
55
+ 1. Read `design-system/MASTER.md` for global rules.
56
+ 2. Check for page-specific overrides in `design-system/pages/<page_name>.md`.
57
+
58
+ ---
59
+
60
+ ## 4. Quick Trigger Prompt (Universal)
61
+
62
+ To trigger the full power of this integration for ANY task or project, use this concise prompt:
63
+
64
+ > **"Triển khai [Task] theo chuẩn Design Intelligence + Next.js Performance."**
65
+
66
+ **What this triggers in me:**
67
+ 1. **Search**: I will automatically query `skills/ui-ux-pro-max/` for the best design system.
68
+ 2. **Plan**: I will create a `task.md` with integrated design & performance phases.
69
+ 3. **Execute**: I will use CSS variables for theming and Next.js Best Practices for code.
70
+
71
+ ---
72
+
73
+ ## Related Skills
74
+ - **UI Libraries**: `skills/nextjs/ui-libraries.md` (Integration with shadcn/ui)
75
+ - **Performance**: `skills/nextjs/performance.md` (Visual Performance rules)
76
+ - **Design Database**: `skills/ui-ux-pro-max/SKILL.md` (Original CSV data)
@@ -0,0 +1,68 @@
1
+ # Modern Design Tokens
2
+
3
+ Design tokens are the visual atoms of your design system. Standardizing these ensures professional color harmony, readable typography, and consistent aesthetics across the application.
4
+
5
+ ## 1. Color Harmony (HSL)
6
+
7
+ Always use HSL (Hue, Saturation, Lightness) for colors. It is intuitive and allows for programmatically generating shades.
8
+
9
+ ### Core Palette
10
+ Avoid generic "pure" colors. Use curated HSL values.
11
+
12
+ ```css
13
+ :root {
14
+ /* Neutral Palette - Slate/Zinc */
15
+ --background: 240 10% 3.9%;
16
+ --foreground: 0 0% 98%;
17
+ --muted: 240 3.7% 15.9%;
18
+ --muted-foreground: 240 5% 64.9%;
19
+
20
+ /* Primary - Deep Indigo/Blue */
21
+ --primary: 263.4 70% 50.4%;
22
+ --primary-foreground: 210 20% 98%;
23
+
24
+ /* Accent - Soft Violet */
25
+ --accent: 240 3.7% 15.9%;
26
+ --accent-foreground: 0 0% 98%;
27
+ }
28
+ ```
29
+
30
+ ### Semantic Colors
31
+ Define clear colors for status to improve UX.
32
+
33
+ - **Success**: Emerald (`142.1 70.6% 45.3%`)
34
+ - **Warning**: Amber (`37.9 92.1% 50.2%`)
35
+ - **Destructive**: Rose (`346.8 77.2% 49.8%`)
36
+
37
+ ## 2. Typography Excellence
38
+
39
+ Premium UIs rely on high-quality font stacks and proper spacing.
40
+
41
+ ### Font Stacks
42
+ Use modern, highly legible fonts.
43
+
44
+ ```css
45
+ /* Tailwind Config */
46
+ fontFamily: {
47
+ sans: ['var(--font-geist-sans)', 'Inter', 'system-ui', 'sans-serif'],
48
+ display: ['Outfit', 'var(--font-geist-sans)'],
49
+ }
50
+ ```
51
+
52
+ ### Hierarchy & Leading
53
+ - **Body Text**: `tracking-tight` and `leading-relaxed` (1.625).
54
+ - **Headings**: `tracking-tighter` and `leading-tight` (1.2) for a modern, compact look.
55
+ - **Micro-copy**: `uppercase`, `tracking-widest`, `text-xs`, `font-semibold`.
56
+
57
+ ## 3. Dark Mode Strategy
58
+
59
+ Modern apps must prioritize dark mode. Use "Soft Dark" instead of "Pure Black" (`#000000`) for backgrounds to reduce eye strain.
60
+
61
+ - **Background**: `hsl(240 10% 3.9%)`
62
+ - **Surface/Card**: `hsl(240 10% 6%)`
63
+ - **Border**: `hsl(240 5% 15%)`
64
+
65
+ ## Best Practices
66
+ 1. **Never use Hex/RGB for primary tokens**: Use HSL to allow for opacity modifiers (e.g., `bg-primary/20`).
67
+ 2. **Limit Colors**: Stick to 1 Primary, 1 Neutral, and the 3 Semantic colors.
68
+ 3. **Contrast First**: Always verify your foreground/background contrast using APCA or WCAG 2.1 standards.
@@ -52,6 +52,17 @@ Ensure the server or CDN uses GZIP/Brotli to compress JSON responses.
52
52
 
53
53
  ---
54
54
 
55
+ ## 4. Visual Performance (Design Intelligence)
56
+
57
+ Design choices impact technical performance. Balance aesthetics with the 60FPS target:
58
+
59
+ 1. **Glassmorphism**: Limit `backdrop-blur` usage. Multiple layers can cause heavy CPU/GPU load on lower-end devices.
60
+ 2. **Animations**: Use `will-change: transform` for hardware acceleration. Avoid animating `width`, `height`, or `margin`.
61
+ 3. **SVGs vs Emojis**: Never use emojis for UI icons. SVGs offer superior performance (vector), accessibility (aria-label), and brand consistency.
62
+
63
+ ---
64
+
55
65
  ## Related Skills
66
+ - **Design Intelligence**: `skills/nextjs/design-intelligence.md`
56
67
  - **Interactivity & Animation**: `skills/nextjs/interactivity.md`
57
68
  - **UI State Management**: `skills/nextjs/ui-state.md`
@@ -0,0 +1,61 @@
1
+ # Premium Effects
2
+
3
+ These advanced visual techniques provide the "WOW" factor that differentiates a professional application from a basic one.
4
+
5
+ ## 1. Glassmorphism
6
+
7
+ A modern aesthetic that uses semi-transparent, blurred backgrounds to create a "frosted glass" look.
8
+
9
+ ```tsx
10
+ /* Standard Glassmorphism Card */
11
+ <div className="
12
+ bg-white/10 backdrop-blur-md
13
+ border border-white/20 rounded-2xl
14
+ shadow-xl
15
+ ">
16
+ Content appears on a glass surface
17
+ </div>
18
+ ```
19
+
20
+ ### Critical Rules for Glassmorphism:
21
+ - **Background**: Ensure the underlying background has enough color/texture for the blur to be noticeable.
22
+ - **Borders**: Always use a semi-transparent white/light border (`border-white/20`) to define the edges.
23
+ - **Contrast**: Check text readability carefully; dark mode often works better with glassmorphism.
24
+
25
+ ## 2. Sophisticated Gradients
26
+
27
+ Avoid hard, two-color linear gradients. Use multi-stop or mesh gradients for a premium feel.
28
+
29
+ ```css
30
+ /* Mesh Gradient Example */
31
+ .bg-mesh {
32
+ background-color: hsla(240, 100%, 5%, 1);
33
+ background-image:
34
+ radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%),
35
+ radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%),
36
+ radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
37
+ }
38
+ ```
39
+
40
+ - **Brand Glow**: Use a subtle gradient on primary buttons or active states.
41
+ - **Text Gradients**: Use `bg-clip-text text-transparent bg-gradient-to-r` for high-impact headlines.
42
+
43
+ ## 3. Grain & Texture
44
+
45
+ Adding subtle noise or textures prevents the UI from looking "too flat."
46
+
47
+ - **SVG Noise**: A very low opacity (1-3%) SVG noise layer over backgrounds.
48
+ - **Pattern Overlays**: Subtle dot grids or geometric patterns at 5% opacity.
49
+
50
+ ## 4. Micro-interactions (The "Alive" Feel)
51
+
52
+ Use Framer Motion to add organic movement.
53
+
54
+ - **Hover Reveal**: Animate an element's opacity or position slightly when a parent card is hovered.
55
+ - **Floating Effects**: Subtle vertical floating for cards or high-priority icons (`animate={{ y: [0, -4, 0] }}`).
56
+ - **Staggered Entry**: Use `staggerChildren` in Framer Motion to reveal lists item by item instead of all at once.
57
+
58
+ ## Best Practices
59
+ 1. **Don't Overdo It**: Too many effects (blur + gradient + grain + noise) can look messy and impact performance.
60
+ 2. **Performance First**: `backdrop-blur` is heavy on GPUs. Use it sparingly, mainly for navbars or small overlays.
61
+ 3. **Accessibility**: Never communicate information *only* through a visual effect; ensure proper contrast and ARIA labels.
@@ -0,0 +1,65 @@
1
+ # Premium Inputs & Buttons
2
+
3
+ The most interactive elements of your application deserve the most attention. Standardizing these prevents "clunky" or "ugly" user interfaces.
4
+
5
+ ## 1. Button Archetypes
6
+
7
+ Every button should have a clear purpose and a distinct visual style.
8
+
9
+ | Variant | Usage | Style |
10
+ |:---|:---|:---|
11
+ | **Primary** | Main Action (Save, Submit) | Solid brand color, high contrast. |
12
+ | **Secondary** | Secondary Action (Cancel, Edit) | Outline or subtle background. |
13
+ | **Ghost** | Tertiary Action (Navigation) | No background/border until hover. |
14
+ | **Subtle** | Low-priority utility | Very low contrast background. |
15
+
16
+ ### Interactive States (The "Vibe")
17
+ Always add micro-interactions to buttons to make them feel responsive.
18
+
19
+ ```tsx
20
+ <button className="
21
+ px-4 py-2 rounded-lg font-medium transition-all
22
+ hover:scale-[1.02] active:scale-[0.98]
23
+ hover:brightness-110 active:brightness-90
24
+ focus-visible:ring-2 focus-visible:ring-primary/50
25
+ ">
26
+ Click Me
27
+ </button>
28
+ ```
29
+
30
+ ## 2. Input Polish
31
+
32
+ Modern inputs should feel deep and clean.
33
+
34
+ - **Height**: Minimum `40px` (h-10) for readability and touch targets.
35
+ - **Padding**: Horizontal `12px` (px-3), Vertical `8px` (py-2).
36
+ - **Focus State**: Use a subtle inner shadow or a distinct (but not jarring) border glow.
37
+
38
+ ```tsx
39
+ <input className="
40
+ w-full bg-background border border-input rounded-md px-3 py-2
41
+ placeholder:text-muted-foreground
42
+ focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary
43
+ transition-shadow
44
+ " />
45
+ ```
46
+
47
+ ## 3. Shared Field Patterns
48
+
49
+ - **Label Placement**: Place labels 4px-8px above the input. Use `text-sm font-medium`.
50
+ - **Help/Error Text**: Use `text-[12px]` (text-xs) and ensure `Destructive` color for errors.
51
+ - **Required Indicator**: Use a subtle dot or `*` in the brand color, not just plain red.
52
+
53
+ ## 4. Loading States
54
+
55
+ Never leave a user guessing. If a button triggers an async action, it *must* show a loading state.
56
+
57
+ - **Spinner**: Small, centered, matching the text color.
58
+ - **Text change**: Optionally change "Submit" to "Submitting...".
59
+ - **Disabling**: Disable the button to prevent double-submissions.
60
+
61
+ ## Best Practices
62
+ 1. **Touch Targets**: Ensure all clickable elements are at least `44x44px` on mobile.
63
+ 2. **Clear Affordance**: Buttons should look like buttons (radius, slight shadow, or distinct color).
64
+ 3. **Contrast**: Ensure text inside buttons is highly readable (Primary foreground vs Primary background).
65
+ 4. **No Placeholders as Labels**: Never use `placeholder` as a substitute for a real `<label>`.
@@ -0,0 +1,56 @@
1
+ # Responsive Design
2
+
3
+ Ensuring the application is usable and beautiful on every screen size, from mobile phones to ultra-wide monitors. We follow a **Mobile-First** approach.
4
+
5
+ ## 1. Mobile-First Workflow
6
+
7
+ Always start with mobile styles (default) and use Tailwind breakpoints to "add" complexity for larger screens.
8
+
9
+ - **Mobile (Default)**: Single column, full-width buttons, condensed headers.
10
+ - **Tablet (`md:`)**: Two columns, sidebar reveals, increased padding.
11
+ - **Desktop (`lg:`)**: Multi-column layouts, full navigation menus, expanded content.
12
+
13
+ ```tsx
14
+ /* Responsive Container Example */
15
+ <div className="
16
+ grid grid-cols-1 gap-4
17
+ md:grid-cols-2 lg:grid-cols-3
18
+ p-4 md:p-8
19
+ ">
20
+ {/* Content adapts to screen size */}
21
+ </div>
22
+ ```
23
+
24
+ ## 2. Standard Breakpoints
25
+
26
+ Stick to Tailwind's default breakpoints for consistency:
27
+
28
+ | Breakpoint | Prefix | Width | Usage |
29
+ |:---|:---|:---|:---|
30
+ | **Small** | `sm:` | 640px | Small tablets / Large phones |
31
+ | **Medium** | `md:` | 768px | Tablets (Portrait) |
32
+ | **Large** | `lg:` | 1024px | Laptops / Tablets (Landscape) |
33
+ | **Extra Large**| `xl:` | 1280px | Desktops |
34
+
35
+ ## 3. Fluid Typography & Spacing
36
+
37
+ Instead of hardcoding sizes, use relative units or clamp functions for elements that need to scale smoothly.
38
+
39
+ - **Prefer**: `text-base md:text-lg` over a static size.
40
+ - **Stacking**: Use `flex-col md:flex-row` for components that should stack on mobile but be side-by-side on desktop.
41
+
42
+ ## 4. Touch-Friendly UI (Mobile)
43
+
44
+ - **Hit Targets**: Buttons and links must be at least `44x44px`.
45
+ - **No Hover for Logic**: Never hide critical functionality behind a hover state on mobile (mobile has no hover).
46
+ - **Navigation**: Use "Hamburger" menus or bottom bars for mobile navigation.
47
+
48
+ ## 5. Responsive Media
49
+
50
+ - **Images**: Use `next/image` with `sizes` attribute to prevent loading massive images on small screens.
51
+ - **Aspect Ratio**: Use `aspect-video` or `aspect-square` to maintain proportions during resizing.
52
+
53
+ ## Best Practices
54
+ 1. **Test in Browser**: Always verify by resizing the browser or using Device Mode in DevTools.
55
+ 2. **Avoid "Hiding" Content**: Try to reorganize content rather than using `hidden` to remove logic for mobile users.
56
+ 3. **Overflow Handling**: Always use `overflow-x-hidden` on the main container to prevent accidental horizontal scrolling.