diff options
Diffstat (limited to 'src/app/(auth)/register.tsx')
| -rw-r--r-- | src/app/(auth)/register.tsx | 214 |
1 files changed, 161 insertions, 53 deletions
diff --git a/src/app/(auth)/register.tsx b/src/app/(auth)/register.tsx index 0eeb058..0b57ce5 100644 --- a/src/app/(auth)/register.tsx +++ b/src/app/(auth)/register.tsx @@ -1,9 +1,14 @@ import { Link } from 'expo-router'; import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native'; +import { MaterialIcons } from '@expo/vector-icons'; +import theme from '@/theme'; import { useRegister } from '@/features/auth/hooks/useRegister'; import { StatusMessage } from '@/shared/ui/StatusMessage'; +const { colors, spacing, radius, typography, fontWeight, layout, shadows } = theme; + export default function RegisterScreen() { + // hook de registro const { displayName, email, @@ -18,78 +23,181 @@ export default function RegisterScreen() { return ( <View style={styles.container}> - <Text style={styles.title}>Registrarse</Text> - - <TextInput - style={styles.input} - placeholder="Nombre" - value={displayName} - onChangeText={setDisplayName} - /> - - <TextInput - style={styles.input} - placeholder="Correo electrónico" - autoCapitalize="none" - keyboardType="email-address" - value={email} - onChangeText={setEmail} - /> - - <TextInput - style={styles.input} - placeholder="Contraseña" - secureTextEntry - value={password} - onChangeText={setPassword} - /> - - {error ? <StatusMessage message={error} /> : null} - - <Pressable style={styles.button} onPress={submit} disabled={isSubmitting}> - <Text style={styles.buttonText}> - {isSubmitting ? 'Registrando...' : 'Crear cuenta'} - </Text> - </Pressable> - - <Link href="/(auth)/login" style={styles.link}> - ¿Ya tienes cuenta? Inicia sesión - </Link> + {/* contenido central acotado */} + <View style={styles.content}> + {/* icono superior */} + <View style={styles.iconBox}> + <MaterialIcons name="business" size={28} color={colors.white} /> + </View> + + {/* titulo principal */} + <Text style={styles.title}>Crear cuenta</Text> + + {/* subtitulo */} + <Text style={styles.subtitle}>Únete a App Oficina hoy mismo</Text> + + {/* tarjeta del formulario */} + <View style={styles.formCard}> + {/* campo nombre */} + <Text style={styles.label}>Nombre completo</Text> + <TextInput + style={styles.input} + placeholder="Ej: Juan Pérez" + placeholderTextColor={colors.textSecondary} + value={displayName} + onChangeText={setDisplayName} + /> + + {/* campo correo */} + <Text style={styles.label}>Correo electrónico</Text> + <TextInput + style={styles.input} + placeholder="tu@email.com" + placeholderTextColor={colors.textSecondary} + autoCapitalize="none" + keyboardType="email-address" + value={email} + onChangeText={setEmail} + /> + + {/* campo contraseña */} + <Text style={styles.label}>Contraseña</Text> + <TextInput + style={styles.input} + placeholder="Mínimo 8 caracteres" + placeholderTextColor={colors.textSecondary} + secureTextEntry + value={password} + onChangeText={setPassword} + /> + + {/* mensaje de error */} + {error ? <StatusMessage message={error} /> : null} + + {/* boton principal */} + <Pressable style={styles.button} onPress={submit} disabled={isSubmitting}> + <Text style={styles.buttonText}> + {isSubmitting ? 'Registrando...' : 'Crear cuenta'} + </Text> + </Pressable> + </View> + + {/* enlace inferior a login */} + <Link href="/(auth)/login" style={styles.link}> + ¿Ya tienes cuenta? <Text style={styles.linkHighlight}>Inicia sesión</Text> + </Link> + </View> </View> ); } const styles = StyleSheet.create({ + // contenedor principal de la pantalla container: { flex: 1, + backgroundColor: colors.background, + }, + + // contenido central acotado y centrado + content: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + paddingHorizontal: spacing.xl, + paddingTop: spacing.xl, + paddingBottom: spacing.xl, + gap: spacing.lg, + maxWidth: layout.contentWidth, + width: '100%', + alignSelf: 'center', + }, + + // caja azul del icono superior + iconBox: { + width: 56, + height: 56, + borderRadius: radius.lg, + backgroundColor: colors.primary, + alignItems: 'center', justifyContent: 'center', - padding: 24, - gap: 12, + alignSelf: 'center', + ...shadows.card, }, + + // titulo principal title: { - fontSize: 28, - fontWeight: '700', - marginBottom: 16, + fontSize: 36, + fontWeight: fontWeight.semibold, + color: colors.text, + textAlign: 'center', + }, + + // subtitulo explicativo + subtitle: { + fontSize: typography.md, + color: colors.textSecondary, + textAlign: 'center', + lineHeight: 22, + }, + + // tarjeta del formulario de registro + formCard: { + width: '100%', + backgroundColor: colors.surface, + borderRadius: radius.xxl, + borderWidth: 1, + borderColor: colors.border, + padding: spacing.lg, + gap: spacing.md, + ...shadows.card, + }, + + // texto de etiqueta de los inputs + label: { + fontSize: typography.sm, + color: colors.text, + fontWeight: fontWeight.medium, }, + + // input de formulario input: { borderWidth: 1, - borderColor: '#ccc', - borderRadius: 10, - paddingHorizontal: 14, - paddingVertical: 12, + borderColor: colors.border, + borderRadius: radius.md, + paddingHorizontal: spacing.lg, + paddingVertical: spacing.md, + backgroundColor: colors.background, + color: colors.text, }, + + // boton principal button: { - backgroundColor: '#1f6feb', - paddingVertical: 14, - borderRadius: 10, + backgroundColor: colors.primary, + paddingVertical: spacing.lg, + borderRadius: radius.md, alignItems: 'center', - marginTop: 8, + justifyContent: 'center', + marginTop: spacing.sm, }, + + // texto del boton principal buttonText: { - color: '#fff', - fontWeight: '600', + color: colors.white, + fontWeight: fontWeight.semibold, + fontSize: typography.md, }, + + // enlace inferior link: { - marginTop: 12, + marginTop: spacing.sm, + fontSize: typography.md, + color: colors.textSecondary, + textAlign: 'center', + }, + + // parte destacada del enlace + linkHighlight: { + color: colors.primary, + fontWeight: fontWeight.medium, }, }); |