polish(mobile): audit design DSFR multi-agents — tokens, a11y, états, finitions
- tokens centralisés (Tint, IconSize, LineHeight, LetterSpacing), zéro hex en dur - accessibilité (rôles, labels, live regions, afficher/masquer mot de passe) - états vides/erreur complétés (ex. saisie introuvable), cibles tactiles >=44px - suppression du composant mort RepubliqueHeader Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
import { Colors } from '@/lib/colors';
|
||||
import { FontSize, FontWeight, Radius, Spacing } from '@/lib/theme';
|
||||
import { FontSize, FontWeight, LetterSpacing, Radius, Spacing, Tint } from '@/lib/theme';
|
||||
|
||||
type Tone = 'neutral' | 'success' | 'error' | 'info' | 'warning' | 'primary';
|
||||
|
||||
@@ -14,7 +14,7 @@ interface BadgeProps {
|
||||
|
||||
/** Pastille d'état DSFR, taille homogène. */
|
||||
export default function Badge({ label, tone = 'neutral', color, uppercase = false }: BadgeProps) {
|
||||
const palette = color ? { bg: hexWithAlpha(color, 0.14), text: darken(color) } : TONES[tone];
|
||||
const palette = color ? { bg: hexWithAlpha(color, 0.14), text: color } : TONES[tone];
|
||||
return (
|
||||
<View style={[styles.badge, { backgroundColor: palette.bg }]}>
|
||||
<Text style={[styles.text, { color: palette.text }, uppercase && styles.uppercase]} numberOfLines={1}>
|
||||
@@ -28,9 +28,9 @@ const TONES: Record<Tone, { bg: string; text: string }> = {
|
||||
neutral: { bg: Colors.gray[100], text: Colors.gray[600] },
|
||||
success: { bg: Colors.successBg, text: Colors.success },
|
||||
error: { bg: Colors.errorBg, text: Colors.error },
|
||||
info: { bg: '#E8EDFF', text: Colors.info },
|
||||
warning: { bg: '#FFE9C7', text: Colors.warning },
|
||||
primary: { bg: '#E3E3FD', text: Colors.primary },
|
||||
info: { bg: Tint.info, text: Colors.info },
|
||||
warning: { bg: Tint.warning, text: Colors.warning },
|
||||
primary: { bg: Tint.primary, text: Colors.primary },
|
||||
};
|
||||
|
||||
/** Ajoute un canal alpha (0–1) à une couleur hex #RRGGBB. */
|
||||
@@ -39,18 +39,13 @@ function hexWithAlpha(hex: string, alpha: number): string {
|
||||
return `${hex}${a}`;
|
||||
}
|
||||
|
||||
/** Pour le texte sur fond teinté, on garde la couleur d'origine (lisible sur 14% d'alpha). */
|
||||
function darken(hex: string): string {
|
||||
return hex;
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
badge: {
|
||||
alignSelf: 'flex-start',
|
||||
paddingHorizontal: Spacing.sm,
|
||||
paddingVertical: 3,
|
||||
paddingVertical: Spacing.xs - 1,
|
||||
borderRadius: Radius.sm,
|
||||
},
|
||||
text: { fontSize: FontSize.tiny, fontWeight: FontWeight.bold },
|
||||
uppercase: { textTransform: 'uppercase', letterSpacing: 0.5 },
|
||||
uppercase: { textTransform: 'uppercase', letterSpacing: LetterSpacing.sm },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user