91ceca2be5
- 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>
48 lines
1.8 KiB
TypeScript
48 lines
1.8 KiB
TypeScript
import { StyleSheet, Text, View } from 'react-native';
|
|
import { Ionicons } from '@expo/vector-icons';
|
|
import { Colors } from '@/lib/colors';
|
|
import { FontSize, FontWeight, ICON_CIRCLE, IconSize, LineHeight, Radius, Spacing, Tint } from '@/lib/theme';
|
|
import Button from './Button';
|
|
|
|
interface EmptyStateProps {
|
|
icon?: keyof typeof Ionicons.glyphMap;
|
|
title: string;
|
|
message?: string;
|
|
actionLabel?: string;
|
|
onAction?: () => void;
|
|
}
|
|
|
|
/** État vide homogène : icône, titre, message et action optionnelle. */
|
|
export default function EmptyState({ icon = 'document-text-outline', title, message, actionLabel, onAction }: EmptyStateProps) {
|
|
return (
|
|
<View style={styles.container}>
|
|
<View style={styles.iconCircle}>
|
|
<Ionicons name={icon} size={IconSize.xl} color={Colors.primary} />
|
|
</View>
|
|
<Text style={styles.title}>{title}</Text>
|
|
{message ? <Text style={styles.message}>{message}</Text> : null}
|
|
{actionLabel && onAction ? (
|
|
<View style={styles.action}>
|
|
<Button title={actionLabel} onPress={onAction} icon="add" />
|
|
</View>
|
|
) : null}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: { alignItems: 'center', justifyContent: 'center', paddingVertical: Spacing.xxxl, paddingHorizontal: Spacing.xl },
|
|
iconCircle: {
|
|
width: ICON_CIRCLE,
|
|
height: ICON_CIRCLE,
|
|
borderRadius: Radius.pill,
|
|
backgroundColor: Tint.primary,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
marginBottom: Spacing.lg,
|
|
},
|
|
title: { fontSize: FontSize.lg, fontWeight: FontWeight.bold, color: Colors.black, textAlign: 'center' },
|
|
message: { fontSize: FontSize.sm, color: Colors.gray[500], textAlign: 'center', marginTop: Spacing.sm, lineHeight: LineHeight.normal },
|
|
action: { marginTop: Spacing.xl },
|
|
});
|