Skip to content

Commit

Permalink
started implementing form
Browse files Browse the repository at this point in the history
  • Loading branch information
heismoody committed Jan 9, 2025
1 parent 38abe32 commit 811c195
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 34 deletions.
38 changes: 4 additions & 34 deletions app/AdminPanel/AdminPages/Explore/page.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
import React from "react";
import TabHeader from "../../Components/header";
import FormContainer from "@/app/components/form";

const Explore = () => {
return (
<TabHeader title="Explore Page">
<form className="flex justify-center gap-2">
<div className="flex flex-col w-[90%]">
<label htmlFor="LandTitle" className="text-xl font-bold pt-5">
Land Page Title:
</label>
<input
type="text"
name="LandTitle"
id=""
className="py-1 px-2 text-lg focus:outline-none bg-secondary"
placeholder="Welcome Note"
value={"Welcome Note"}
disabled
/>
<label htmlFor="Description" className="text-xl font-bold pt-3">
Land Page Description:
</label>
<textarea
name="Description"
id=""
className="p-2 resize-none focus:outline-none"
rows={6}
/>
<button
type="submit"
className="text-xl px-4 py-1 bg-[#efb631] text-black font-bold rounded-lg w-fit mt-5 items-end"
>
Submit
</button>
</div>
</form>
<FormContainer/>
<span className="flex text-4xl font-bold pb-2 border-b-2 border-black/20 pt-10">
Section One
</span>
Expand All @@ -59,7 +30,7 @@ const Explore = () => {
className="p-2 resize-none focus:outline-none"
rows={2}
/>
<label htmlFor="Description" className="flex text-xl font-bold pt-5">
<label htmlFor="Description" className="flex text-xl font-bold pt-5">
Vision Description:
</label>
<textarea
Expand All @@ -76,7 +47,6 @@ const Explore = () => {
</button>
</div>
<div className="w-[40%]">

<label htmlFor="Description" className="flex text-xl font-bold pt-5">
Mission Description:
</label>
Expand Down Expand Up @@ -122,7 +92,7 @@ const Explore = () => {
className="p-2 resize-none focus:outline-none"
rows={4}
/>
<label htmlFor="LandTitle" className="text-xl font-bold pt-5">
<label htmlFor="LandTitle" className="text-xl font-bold pt-5">
Core Value Title:
</label>
<input
Expand Down
61 changes: 61 additions & 0 deletions app/components/form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use client";
import React, { useState } from "react";
import { IFormContainer } from "./types";

const FormContainer = () => {
const [formData, setFormData] = useState({});

const handleChange = (
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) => {
const { name, value } = e.target;
setFormData((prevData) => ({
...prevData,
[name]: value,
}));
};

const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
console.log(JSON.stringify(formData));
};
return (
<form
className="flex flex-col justify-center gap-2 items-center"
onSubmit={handleSubmit}
>
<div className="flex flex-col w-[90%]">
<label htmlFor="LandTitle" className="text-xl font-bold pt-5">
Land Page Title:
</label>
<input
type="text"
name="LandTitle"
id=""
className="py-1 px-2 text-lg focus:outline-none bg-secondary"
placeholder="Welcome Note"
value={"Welcome Note"}
disabled
/>
<label htmlFor="Description" className="text-xl font-bold pt-3">
Land Page Description:
</label>
<textarea
name="Description"
id=""
className="p-2 resize-none focus:outline-none"
onChange={handleChange}
rows={6}
/>
</div>
<button
type="submit"
className="text-xl px-4 py-1 bg-[#efb631] text-black font-bold rounded-lg w-fit mt-5 items-end"
>
Submit
</button>
</form>
);
};

export default FormContainer;
4 changes: 4 additions & 0 deletions app/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ export interface IDialog {
dialogTitle: string;
children: ReactNode;
className: string;
}

export interface IFormContainer{
children: ReactNode;
}

0 comments on commit 811c195

Please sign in to comment.