diff --git a/wretched-machines-frontend/src/app/(auth)/login/page.tsx b/wretched-machines-frontend/src/app/(auth)/login/page.tsx index 52f04fe..6536540 100644 --- a/wretched-machines-frontend/src/app/(auth)/login/page.tsx +++ b/wretched-machines-frontend/src/app/(auth)/login/page.tsx @@ -1,8 +1,48 @@ +"use client" + +import Form from "@/components/ui/form"; +import { FormLabel, FormSubmitInput, FormTextInput } from "@/components/ui/form-input"; +import { ChangeEvent, useState } from "react"; + const Login = () => { + + const [inputData, setInputData] = useState({ + "email": "", + "password": "" + }); + + const handleAction = (formData: FormData) => { + console.log(formData.get("email") + " " + formData.get("password")); + } + + const handleChange = (e: ChangeEvent) => { + e.preventDefault(); + setInputData({ + ...inputData, + [e.target.name]: e.target.value + }); + } + return ( - +
+
+
+
+ + Test +
+
+ + Test +

Please choose a password.

+
+
+ +
+
+
+ +
); } diff --git a/wretched-machines-frontend/src/components/ui/form-input.tsx b/wretched-machines-frontend/src/components/ui/form-input.tsx new file mode 100644 index 0000000..d7309ad --- /dev/null +++ b/wretched-machines-frontend/src/components/ui/form-input.tsx @@ -0,0 +1,45 @@ +interface FormTextInputProps { + value: string, + name: string, + onChangeHandler: React.ChangeEventHandler, + type: "text" | "password" | "email", + children?: React.ReactNode, + className?: string, + placeholder?: string +} + +interface FormSubmitInputProps { + name: string, + value: string | undefined, + onSubmitHandler: React.FormEventHandler | undefined, + children?: React.ReactNode, + className?: string +} + +interface FormLabelProps { + name: string, + className?: string +} + +const FormLabel = (props: FormLabelProps) => { + const label = props.name.charAt(0).toUpperCase() + props.name.slice(1); + return(); +} + +const FormTextInput = (props: FormTextInputProps) => { + return( + + ); +} + +const FormSubmitInput = (props: FormSubmitInputProps) => { + return( + {props.children} + ); +} + +export { + FormTextInput, + FormSubmitInput, + FormLabel +}; \ No newline at end of file diff --git a/wretched-machines-frontend/src/components/ui/form.tsx b/wretched-machines-frontend/src/components/ui/form.tsx new file mode 100644 index 0000000..df2ac9b --- /dev/null +++ b/wretched-machines-frontend/src/components/ui/form.tsx @@ -0,0 +1,17 @@ +import React from "react" + +interface FormProps { + children: React.ReactNode, + formAction: ((formData: FormData) => void), + className?: string +} + +const Form = (props: FormProps) => { + return( +
+ {props.children} +
+ ); +} + +export default Form \ No newline at end of file diff --git a/wretched-machines-frontend/src/components/ui/navbar.tsx b/wretched-machines-frontend/src/components/ui/navbar.tsx index f2270f6..95466b5 100644 --- a/wretched-machines-frontend/src/components/ui/navbar.tsx +++ b/wretched-machines-frontend/src/components/ui/navbar.tsx @@ -16,6 +16,9 @@ const Navbar = () => {
Demos
+ +
Login
+ ); }