193 lines
7.2 KiB
Markdown
193 lines
7.2 KiB
Markdown
|
|
# Input Component Styling Audit
|
||
|
|
|
||
|
|
**Generated**: 2025-01-27
|
||
|
|
**Purpose**: Document current styling of Input component for simplification
|
||
|
|
**Action**: 9.5.1.1
|
||
|
|
**File**: `apps/web/src/components/ui/input.tsx`
|
||
|
|
|
||
|
|
## Executive Summary
|
||
|
|
|
||
|
|
The Input component currently has **complex styling** with multiple decorative effects, transitions, and state-specific classes. This audit documents all styling classes and identifies opportunities for simplification.
|
||
|
|
|
||
|
|
## Current Styling Analysis
|
||
|
|
|
||
|
|
### Component Location
|
||
|
|
- **File**: `apps/web/src/components/ui/input.tsx`
|
||
|
|
- **Line**: 13 (className string)
|
||
|
|
- **Total Classes**: 25+ individual Tailwind classes in a single string
|
||
|
|
|
||
|
|
### Complete Class Breakdown
|
||
|
|
|
||
|
|
#### Layout & Sizing
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `flex` | Flexbox layout | ✅ Essential |
|
||
|
|
| `h-10` | Fixed height (40px) | ✅ Essential |
|
||
|
|
| `w-full` | Full width | ✅ Essential |
|
||
|
|
|
||
|
|
#### Border & Shape
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `rounded-xl` | Large border radius (12px) | ⚠️ Could simplify to `rounded-lg` |
|
||
|
|
| `border` | Border base | ✅ Essential |
|
||
|
|
| `border-white/10` | Default border (10% opacity white) | ✅ Essential |
|
||
|
|
| `hover:border-white/15` | Hover border (15% opacity white) | ⚠️ Subtle, could remove |
|
||
|
|
|
||
|
|
#### Background
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `bg-black/20` | Default background (20% opacity black) | ✅ Essential |
|
||
|
|
| `focus-visible:bg-black/30` | Focus background (30% opacity black) | ⚠️ Could simplify |
|
||
|
|
| `backdrop-blur-sm` | Backdrop blur effect | ❌ **Unnecessary decoration** |
|
||
|
|
|
||
|
|
#### Text & Typography
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `text-sm` | Small text size | ✅ Essential |
|
||
|
|
| `text-white` | White text color | ✅ Essential |
|
||
|
|
| `placeholder:text-kodo-secondary/50` | Placeholder text color | ✅ Essential |
|
||
|
|
|
||
|
|
#### Padding
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `px-4` | Horizontal padding (16px) | ✅ Essential |
|
||
|
|
| `py-2.5` | Vertical padding (10px) | ✅ Essential |
|
||
|
|
|
||
|
|
#### Focus State
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `focus-visible:outline-none` | Remove default outline | ✅ Essential |
|
||
|
|
| `focus-visible:ring-2` | Focus ring width | ❌ **Should be border instead** |
|
||
|
|
| `focus-visible:ring-kodo-cyan` | Focus ring color | ❌ **Should be border instead** |
|
||
|
|
| `focus-visible:border-kodo-cyan/50` | Focus border (50% opacity cyan) | ⚠️ **Redundant with ring** |
|
||
|
|
| `ring-offset-kodo-void` | Ring offset color | ❌ **Not needed if using border** |
|
||
|
|
|
||
|
|
#### Disabled State
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `disabled:cursor-not-allowed` | Disabled cursor | ✅ Essential |
|
||
|
|
| `disabled:opacity-50` | Disabled opacity | ✅ Essential |
|
||
|
|
|
||
|
|
#### Transitions
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `transition-all` | Transition all properties | ⚠️ Could be more specific |
|
||
|
|
| `duration-200` | Transition duration (200ms) | ✅ Essential |
|
||
|
|
|
||
|
|
#### File Input Styling
|
||
|
|
| Class | Purpose | Status |
|
||
|
|
|-------|---------|--------|
|
||
|
|
| `file:border-0` | Remove file input border | ✅ Essential |
|
||
|
|
| `file:bg-transparent` | Transparent file input bg | ✅ Essential |
|
||
|
|
| `file:text-sm` | File input text size | ✅ Essential |
|
||
|
|
| `file:font-medium` | File input font weight | ✅ Essential |
|
||
|
|
|
||
|
|
## Issues Identified
|
||
|
|
|
||
|
|
### 1. **Complex Focus State** ❌
|
||
|
|
**Current**: Uses both `ring` and `border` for focus
|
||
|
|
- `focus-visible:ring-2 focus-visible:ring-kodo-cyan` (ring)
|
||
|
|
- `focus-visible:border-kodo-cyan/50` (border)
|
||
|
|
|
||
|
|
**Issue**: Redundant styling - ring and border both indicate focus
|
||
|
|
**Recommendation**: Use only `border-kodo-cyan` for focus (no ring, no glow)
|
||
|
|
|
||
|
|
### 2. **Unnecessary Backdrop Blur** ❌
|
||
|
|
**Current**: `backdrop-blur-sm`
|
||
|
|
**Issue**: Adds visual complexity without clear benefit
|
||
|
|
**Recommendation**: Remove backdrop blur
|
||
|
|
|
||
|
|
### 3. **Overly Broad Transitions** ⚠️
|
||
|
|
**Current**: `transition-all`
|
||
|
|
**Issue**: Transitions all properties, including unnecessary ones
|
||
|
|
**Recommendation**: Use specific transitions: `transition-colors transition-opacity`
|
||
|
|
|
||
|
|
### 4. **Subtle Hover Effect** ⚠️
|
||
|
|
**Current**: `hover:border-white/15` (changes from 10% to 15% opacity)
|
||
|
|
**Issue**: Very subtle, may not be noticeable
|
||
|
|
**Recommendation**: Either remove or make more noticeable
|
||
|
|
|
||
|
|
### 5. **Complex Border Radius** ⚠️
|
||
|
|
**Current**: `rounded-xl` (12px)
|
||
|
|
**Issue**: Larger than typical inputs
|
||
|
|
**Recommendation**: Consider `rounded-lg` (8px) for consistency
|
||
|
|
|
||
|
|
## Usage Analysis
|
||
|
|
|
||
|
|
### Import Count
|
||
|
|
- **Total imports**: 100+ files use the Input component
|
||
|
|
- **Primary usage**: Forms, search bars, modals, settings pages
|
||
|
|
|
||
|
|
### Key Usage Patterns
|
||
|
|
1. **Forms**: Login, Register, Profile, Settings
|
||
|
|
2. **Search**: Track search, playlist search, general search
|
||
|
|
3. **Modals**: Create playlist, add collaborator, API keys
|
||
|
|
4. **Settings**: Account, security, cloud integration
|
||
|
|
|
||
|
|
### Alternative Input Components
|
||
|
|
- `AuthInput` (`features/auth/components/AuthInput.tsx`) - Custom styled input for auth
|
||
|
|
- `SearchInput` (`components/ui/input.tsx`) - Wrapper around Input with search icon
|
||
|
|
- `components/base/Input.tsx` - Legacy base component (minimal styling)
|
||
|
|
|
||
|
|
## Recommendations
|
||
|
|
|
||
|
|
### Priority 1: Remove Complex Decorations
|
||
|
|
1. ✅ Remove `backdrop-blur-sm` - Unnecessary visual effect
|
||
|
|
2. ✅ Simplify focus state - Use `border-kodo-cyan` only (no ring, no glow)
|
||
|
|
3. ✅ Remove `ring-offset-kodo-void` - Not needed with border-only focus
|
||
|
|
|
||
|
|
### Priority 2: Simplify Transitions
|
||
|
|
1. ✅ Replace `transition-all` with specific transitions
|
||
|
|
2. ✅ Keep `duration-200` for consistency
|
||
|
|
|
||
|
|
### Priority 3: Optional Simplifications
|
||
|
|
1. ⚠️ Consider `rounded-lg` instead of `rounded-xl`
|
||
|
|
2. ⚠️ Evaluate hover effect necessity
|
||
|
|
3. ⚠️ Simplify focus background change (may not be needed)
|
||
|
|
|
||
|
|
## Proposed Simplified Styling
|
||
|
|
|
||
|
|
### Minimal Clean Version
|
||
|
|
```tsx
|
||
|
|
className={cn(
|
||
|
|
'flex h-10 w-full rounded-lg border border-kodo-steel',
|
||
|
|
'bg-kodo-graphite px-4 py-2.5 text-sm',
|
||
|
|
'text-kodo-text-main placeholder:text-kodo-content-dim',
|
||
|
|
'focus-visible:outline-none focus-visible:border-kodo-cyan',
|
||
|
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
||
|
|
'transition-colors duration-200',
|
||
|
|
'file:border-0 file:bg-transparent file:text-sm file:font-medium',
|
||
|
|
className,
|
||
|
|
)}
|
||
|
|
```
|
||
|
|
|
||
|
|
### Key Changes
|
||
|
|
- ✅ Removed `backdrop-blur-sm`
|
||
|
|
- ✅ Removed `ring` and `ring-offset` (using border only)
|
||
|
|
- ✅ Simplified focus to `border-kodo-cyan` only
|
||
|
|
- ✅ Changed `transition-all` to `transition-colors`
|
||
|
|
- ✅ Changed `rounded-xl` to `rounded-lg`
|
||
|
|
- ✅ Removed hover border change
|
||
|
|
- ✅ Removed focus background change
|
||
|
|
- ✅ Simplified colors to use Kodo design system
|
||
|
|
|
||
|
|
## Next Steps
|
||
|
|
|
||
|
|
1. **Action 9.5.1.2**: Remove unnecessary decorations (backdrop-blur, complex focus)
|
||
|
|
2. **Action 9.5.1.3**: Simplify styling classes (transitions, border radius)
|
||
|
|
3. **Action 9.5.1.4**: Update focus state to cyan border only (no ring/glow)
|
||
|
|
4. **Action 9.5.1.5**: Remove remaining unnecessary decorations
|
||
|
|
5. **Action 9.5.1.6**: Visual testing
|
||
|
|
|
||
|
|
## Validation Checklist
|
||
|
|
|
||
|
|
- [ ] Current styling documented ✅
|
||
|
|
- [ ] All classes identified and categorized ✅
|
||
|
|
- [ ] Issues identified ✅
|
||
|
|
- [ ] Recommendations provided ✅
|
||
|
|
- [ ] Proposed simplified version created ✅
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Note**: This audit focuses on the `components/ui/input.tsx` component. Other input components (AuthInput, SearchInput) may have different styling and should be audited separately if needed.
|