From 08d12d9a3df1fa062ecc4c67a0a2f686eba4c7c3 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 19 Mar 2024 15:28:06 +0000 Subject: move FormError to components/forms --- src/components/forms/FormError.tsx | 34 ++++++++++++++++++++++++++++++++ src/screens/Login/ForgotPasswordForm.tsx | 2 +- src/screens/Login/FormError.tsx | 34 -------------------------------- src/screens/Login/LoginForm.tsx | 2 +- src/screens/Login/SetNewPasswordForm.tsx | 2 +- 5 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 src/components/forms/FormError.tsx delete mode 100644 src/screens/Login/FormError.tsx (limited to 'src') diff --git a/src/components/forms/FormError.tsx b/src/components/forms/FormError.tsx new file mode 100644 index 000000000..3c6a8649d --- /dev/null +++ b/src/components/forms/FormError.tsx @@ -0,0 +1,34 @@ +import React from 'react' +import {StyleSheet, View} from 'react-native' + +import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/Warning' +import {Text} from '#/components/Typography' +import {atoms as a, useTheme} from '#/alf' +import {colors} from '#/lib/styles' + +export function FormError({error}: {error?: string}) { + const t = useTheme() + + if (!error) return null + + return ( + + + + {error} + + + ) +} + +const styles = StyleSheet.create({ + error: { + backgroundColor: colors.red4, + flexDirection: 'row', + alignItems: 'center', + marginBottom: 15, + borderRadius: 8, + paddingHorizontal: 8, + paddingVertical: 8, + }, +}) diff --git a/src/screens/Login/ForgotPasswordForm.tsx b/src/screens/Login/ForgotPasswordForm.tsx index fa674155a..ab9d02536 100644 --- a/src/screens/Login/ForgotPasswordForm.tsx +++ b/src/screens/Login/ForgotPasswordForm.tsx @@ -17,7 +17,7 @@ import {logger} from '#/logger' import {Button, ButtonText} from '#/components/Button' import {Text} from '#/components/Typography' import {FormContainer} from './FormContainer' -import {FormError} from './FormError' +import {FormError} from '#/components/forms/FormError' type ServiceDescription = ComAtprotoServerDescribeServer.OutputSchema diff --git a/src/screens/Login/FormError.tsx b/src/screens/Login/FormError.tsx deleted file mode 100644 index 3c6a8649d..000000000 --- a/src/screens/Login/FormError.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react' -import {StyleSheet, View} from 'react-native' - -import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/Warning' -import {Text} from '#/components/Typography' -import {atoms as a, useTheme} from '#/alf' -import {colors} from '#/lib/styles' - -export function FormError({error}: {error?: string}) { - const t = useTheme() - - if (!error) return null - - return ( - - - - {error} - - - ) -} - -const styles = StyleSheet.create({ - error: { - backgroundColor: colors.red4, - flexDirection: 'row', - alignItems: 'center', - marginBottom: 15, - borderRadius: 8, - paddingHorizontal: 8, - paddingVertical: 8, - }, -}) diff --git a/src/screens/Login/LoginForm.tsx b/src/screens/Login/LoginForm.tsx index 580155281..ee47aa41d 100644 --- a/src/screens/Login/LoginForm.tsx +++ b/src/screens/Login/LoginForm.tsx @@ -24,7 +24,7 @@ import {At_Stroke2_Corner0_Rounded as At} from '#/components/icons/At' import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock' import {HostingProvider} from '#/components/forms/HostingProvider' import {FormContainer} from './FormContainer' -import {FormError} from './FormError' +import {FormError} from '#/components/forms/FormError' type ServiceDescription = ComAtprotoServerDescribeServer.OutputSchema diff --git a/src/screens/Login/SetNewPasswordForm.tsx b/src/screens/Login/SetNewPasswordForm.tsx index be0732483..678440cf4 100644 --- a/src/screens/Login/SetNewPasswordForm.tsx +++ b/src/screens/Login/SetNewPasswordForm.tsx @@ -16,7 +16,7 @@ import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock' import {Ticket_Stroke2_Corner0_Rounded as Ticket} from '#/components/icons/Ticket' import {Button, ButtonText} from '#/components/Button' import {useTheme, atoms as a} from '#/alf' -import {FormError} from './FormError' +import {FormError} from '#/components/forms/FormError' export const SetNewPasswordForm = ({ error, -- cgit 1.4.1