79 lines
2.0 KiB
TypeScript
79 lines
2.0 KiB
TypeScript
/*
|
|
* File: LoginScreen.tsx
|
|
* Description: Login screen for user authentication
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|
|
|
|
import React, { useState } from 'react';
|
|
import { View, Text, StyleSheet } from 'react-native';
|
|
import { TextInput } from '../../../../shared/src/components/Input';
|
|
import { Button } from '../../../../shared/src/components/Button';
|
|
import { Colors, Spacing, Typography } from '../../../../shared/src/theme';
|
|
import { useDispatch } from 'react-redux';
|
|
import { login } from '../redux/authActions';
|
|
|
|
/**
|
|
* LoginScreen - allows user to login with email and password
|
|
*/
|
|
const LoginScreen: React.FC = () => {
|
|
const [email, setEmail] = useState('');
|
|
const [password, setPassword] = useState('');
|
|
const dispatch = useDispatch();
|
|
|
|
const handleLogin = () => {
|
|
dispatch(login({ email, password }));
|
|
};
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<Text style={styles.title}>Radiologist Portal</Text>
|
|
<TextInput
|
|
placeholder="Email"
|
|
value={email}
|
|
onChangeText={setEmail}
|
|
style={styles.input}
|
|
autoCapitalize="none"
|
|
keyboardType="email-address"
|
|
/>
|
|
<TextInput
|
|
placeholder="Password"
|
|
value={password}
|
|
onChangeText={setPassword}
|
|
style={styles.input}
|
|
secureTextEntry
|
|
/>
|
|
<Button title="Login" onPress={handleLogin} style={styles.button} />
|
|
</View>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: Colors.background,
|
|
justifyContent: 'center',
|
|
padding: Spacing.lg,
|
|
},
|
|
title: {
|
|
fontFamily: Typography.fontFamily.bold,
|
|
fontSize: Typography.fontSize.title,
|
|
color: Colors.primary,
|
|
marginBottom: Spacing.xl,
|
|
textAlign: 'center',
|
|
},
|
|
input: {
|
|
marginBottom: Spacing.md,
|
|
},
|
|
button: {
|
|
marginTop: Spacing.md,
|
|
},
|
|
});
|
|
|
|
export default LoginScreen;
|
|
|
|
/*
|
|
* End of File: LoginScreen.tsx
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|