From 580d3654ef2b43fa05756d54784fbc2130a6c35b Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Wed, 13 Mar 2024 20:54:33 -0400 Subject: [PATCH] Add error messages, register form, user routes --- app/src/frontend/components/error-message.tsx | 9 ++++++ app/src/frontend/components/login-form.tsx | 11 ++----- app/src/frontend/components/register-form.tsx | 29 +++++++++++++++++++ app/src/frontend/pages/register.tsx | 10 +++++++ app/src/handlers/{login.tsx => user.tsx} | 14 ++++++--- app/src/index.tsx | 9 +++--- app/src/middleware/{config.ts => siteData.ts} | 5 ++-- 7 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 app/src/frontend/components/error-message.tsx create mode 100644 app/src/frontend/components/register-form.tsx create mode 100644 app/src/frontend/pages/register.tsx rename app/src/handlers/{login.tsx => user.tsx} (60%) rename app/src/middleware/{config.ts => siteData.ts} (75%) diff --git a/app/src/frontend/components/error-message.tsx b/app/src/frontend/components/error-message.tsx new file mode 100644 index 0000000..e6fd2ea --- /dev/null +++ b/app/src/frontend/components/error-message.tsx @@ -0,0 +1,9 @@ +const ErrorMessage = (props: { message: string }) => { + return ( +
+ {props.message} +
+ ); +}; + +export default ErrorMessage; diff --git a/app/src/frontend/components/login-form.tsx b/app/src/frontend/components/login-form.tsx index 96f71ae..6776b8c 100644 --- a/app/src/frontend/components/login-form.tsx +++ b/app/src/frontend/components/login-form.tsx @@ -1,17 +1,10 @@ import { FC } from "hono/jsx" - -const Error = (props: { message: string }) => { - return ( -
- {props.message} -
- ); -}; +import ErrorMessage from "./error-message"; export const LoginForm: FC = (props) => { return ( <> - {props.error ? : null} + {props.error ? : null}