refactor: Standardisiere Formular-Layout (Label oben, volle Breite, linksbündig)
CSS (frontend/src/app.css): - .form-row: flex-direction column, volle Breite, margin-bottom 16px - .form-label: display block, font-weight 600, linksbündig - .form-input: width 100%, text-align left (statt right 90px), padding 10px 12px - textarea.form-input: resize vertical, min-height 80px - select.form-input: cursor pointer - .form-row--inline: Neue Variante für Ausnahmen (kurze Werte + Einheit) Dokumentation (.claude/rules/CODING_RULES.md): - Neue Regel Frontend §6: Formular-Standard (VERBINDLICH ab 2026-04-22) - Code-Beispiele für Standard-Layout (input, textarea, select) - Klare Regeln: Label = <label>, Pflichtfelder mit *, volle Breite, linksbündig - Inline-Variante nur für Ausnahmen (Zahlen mit Einheit) WICHTIG: Bestehende Formulare (Exercises, Clubs, Skills, TrainingPlanning) nutzen bereits größtenteils diese Struktur und profitieren automatisch von den CSS-Änderungen. Vorteile: - Konsistente UX über alle Formulare - Mobile-friendly (volle Breite, kein horizontal scrolling) - Bessere Lesbarkeit (Label als Überschrift) - Einfacher wartbar (ein Standard für alle) Nächster Schritt: Bestehende Formulare testen, ggf. kleine Anpassungen
This commit is contained in:
1 parent
7f156ba085
commit
cbb783222c
2 files changed
+136
-12
No files matched your search
@@ -78,6 +78,62 @@ style={{color: 'var(--accent)'}}
|
||||
style={{color: '#1D9E75'}}
|
||||
```
|
||||
|
||||
### 6. Formular-Standard (VERBINDLICH ab 2026-04-22)
|
||||
**Alle neuen Formulare verwenden den Standard-Stil:**
|
||||
|
||||
```jsx
|
||||
// ✅ Standard: Label oben, volle Breite, linksbündig
|
||||
<div className="form-row">
|
||||
<label className="form-label">Feldname *</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-input"
|
||||
value={formData.field}
|
||||
onChange={(e) => updateFormField('field', e.target.value)}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
// ✅ Textarea
|
||||
<div className="form-row">
|
||||
<label className="form-label">Beschreibung</label>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={3}
|
||||
value={formData.description}
|
||||
onChange={(e) => updateFormField('description', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
// ✅ Select
|
||||
<div className="form-row">
|
||||
<label className="form-label">Status</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={formData.status}
|
||||
onChange={(e) => updateFormField('status', e.target.value)}
|
||||
>
|
||||
<option value="active">Aktiv</option>
|
||||
<option value="inactive">Inaktiv</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
// ❌ NICHT: Inline-Layout mit Label links
|
||||
// Nur für Ausnahmen (kurze Werte mit Einheit) nutzen:
|
||||
<div className="form-row--inline">
|
||||
<label className="form-label">Dauer</label>
|
||||
<input type="number" className="form-input" value={duration} />
|
||||
<span className="form-unit">min</span>
|
||||
</div>
|
||||
```
|
||||
|
||||
**Regeln:**
|
||||
- Label ist `<label>` mit Klasse `.form-label` (nicht `<div>`)
|
||||
- Input/Textarea/Select nutzen `.form-input`
|
||||
- Volle Breite (100%), linksbündig
|
||||
- Pflichtfelder mit `*` im Label kennzeichnen
|
||||
- Inline-Variante (`.form-row--inline`) nur für Ausnahmen (Zahlen mit Einheit)
|
||||
|
||||
## Git & Deployment
|
||||
|
||||
### 1. Nie direkt auf main pushen
|
||||
|
||||
Reference in new issue
Block a user