-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
482 frontend user signup confirm details (#557)
* Set up confirm details file * Added review details container and section titles * Added new page * Update to display confirm details in sign up * Added details on form * Finished main section of confirm details form * Added page title text * Fixed up some css * Updated all CSS to tailwindcss * Fixed logic error
- Loading branch information
Showing
8 changed files
with
247 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
client/src/components/composite/SignUpForm/Sections/ConfirmDetailsSection.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { ConfirmDetailsSection } from "./ConfirmDetailsSection" | ||
const meta: Meta<typeof ConfirmDetailsSection> = { | ||
component: ConfirmDetailsSection | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = {} |
127 changes: 127 additions & 0 deletions
127
client/src/components/composite/SignUpForm/Sections/ConfirmDetailsSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { useSignUpFormData } from "store/SignUpForm" | ||
import ConfirmDetailsForm from "components/generic/ConfirmDetailsForm/ConfirmDetailsForm" | ||
|
||
const MyText = ({ text = "N/A" }: { text?: string }) => { | ||
return <p className="mb-5">{text}</p> | ||
} | ||
|
||
const Field = ({ text }: { text: string }) => { | ||
return ( | ||
<p className="font-family: Inter; mb-2 mt-5 text-gray-400 opacity-70"> | ||
{text} | ||
</p> | ||
) | ||
} | ||
|
||
const Title = ({ text }: { text: string }) => { | ||
return ( | ||
<p className="font-family: Inter; mt-5 text-sm font-bold uppercase not-italic text-blue-800"> | ||
{text} | ||
</p> | ||
) | ||
} | ||
|
||
const SectionSeparator = () => { | ||
return <hr className="h-px w-4/5 border-gray-400" /> | ||
} | ||
|
||
export const ConfirmDetailsSection = () => { | ||
const [ | ||
{ | ||
first_name, | ||
last_name, | ||
date_of_birth, | ||
gender, | ||
student_id, | ||
university_year, | ||
faculty, | ||
email, | ||
phone_number, | ||
emergency_contact, | ||
does_ski, | ||
does_snowboarding, | ||
does_racing, | ||
dietary_requirements | ||
} | ||
] = useSignUpFormData() | ||
|
||
const full_name = `${first_name} ${last_name}` | ||
|
||
const formatDateOfBirth = ( | ||
timestamp: { seconds: number; nanoseconds: number } | undefined | ||
) => { | ||
if (!timestamp) return "N/A" | ||
|
||
const dob = new Date(timestamp.seconds * 1000) | ||
|
||
const day = dob.getDate().toString().padStart(2, "0") | ||
const month = (dob.getMonth() + 1).toString().padStart(2, "0") | ||
const year = dob.getFullYear() | ||
|
||
return `${day}/${month}/${year}` | ||
} | ||
|
||
return ( | ||
<div> | ||
<p className="font-family: Inter; mb-4 text-base leading-5 text-black"> | ||
Please review member details before proceeding to payment | ||
</p> | ||
|
||
<span className="mb-3 flex gap-5"> | ||
<ConfirmDetailsForm> | ||
<Title text="Personal Details" /> | ||
<Field text="Name" /> | ||
<MyText text={full_name} /> | ||
<Field text="DOB" /> | ||
<MyText text={formatDateOfBirth(date_of_birth)} /> | ||
<Field text="Gender" /> | ||
{gender ? <MyText text={gender} /> : <MyText text="N/A" />}{" "} | ||
<Field text="Student ID Number" /> | ||
<MyText text={student_id} /> | ||
<Field text="University Year" /> | ||
{university_year ? ( | ||
<MyText text={university_year} /> | ||
) : ( | ||
<MyText text="N/A" /> | ||
)}{" "} | ||
<Field text="Faculty" /> | ||
<MyText text={faculty} /> | ||
<SectionSeparator /> | ||
<Title text="Contact Information" /> | ||
<Field text="Email" /> | ||
<MyText text={email} /> | ||
<Field text="Mobile Number" /> | ||
<MyText text={phone_number.toString()} /> | ||
<Field text="Emergency Contact" /> | ||
{emergency_contact ? ( | ||
<MyText text={emergency_contact} /> | ||
) : ( | ||
<MyText text="N/A" /> | ||
)}{" "} | ||
<SectionSeparator /> | ||
<Title text="Additional Information" /> | ||
<Field text="Skier/Snowboarder?" /> | ||
<MyText | ||
text={ | ||
does_ski && does_snowboarding | ||
? "Both" | ||
: does_snowboarding | ||
? "Snowboarder" | ||
: does_ski | ||
? "Skier" | ||
: "New!" | ||
} | ||
/>{" "} | ||
<Field text="Keen on Racing?" /> | ||
<MyText text={does_racing ? "Yes" : "No"} /> | ||
<Field text="Dietary Requirements" /> | ||
{dietary_requirements ? ( | ||
<MyText text={dietary_requirements} /> | ||
) : ( | ||
<MyText text="N/A" /> | ||
)}{" "} | ||
</ConfirmDetailsForm> | ||
</span> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
client/src/components/generic/ConfirmDetailsForm/ConfirmDetailsForm.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
|
||
import ConfirmDetailsForm from "./ConfirmDetailsForm" | ||
|
||
const meta: Meta<typeof ConfirmDetailsForm> = { | ||
component: ConfirmDetailsForm | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof ConfirmDetailsForm> | ||
|
||
export const Default: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
<p>Form Container</p> | ||
</> | ||
) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
client/src/components/generic/ConfirmDetailsForm/ConfirmDetailsForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ReactNode } from "react" | ||
|
||
interface IFormContainerProps { | ||
children: ReactNode | ||
} | ||
|
||
const ConfirmDetailsForm = ({ children }: IFormContainerProps) => { | ||
return ( | ||
<div className="flex-shrink: 0; h-full w-full overflow-y-auto rounded-md border border-gray-400 bg-white pl-6"> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
export default ConfirmDetailsForm |