From db5ea0770e5e56cf70b766cb3cf68922f3ae1541 Mon Sep 17 00:00:00 2001 From: Juthatip McDevitt Date: Sat, 27 Apr 2024 13:50:09 -0500 Subject: [PATCH] updated craete evnt form functionality --- .../create_meeting/_components/meetingForm.js | 61 +++++++++++++++---- .../_components/previewMeeting.js | 9 +++ .../app/(routes)/create_meeting/page.js | 12 +++- scheduler_app/app/_utils/ThemeOption.js | 11 ++++ 4 files changed, 77 insertions(+), 16 deletions(-) create mode 100644 scheduler_app/app/(routes)/create_meeting/_components/previewMeeting.js create mode 100644 scheduler_app/app/_utils/ThemeOption.js diff --git a/scheduler_app/app/(routes)/create_meeting/_components/meetingForm.js b/scheduler_app/app/(routes)/create_meeting/_components/meetingForm.js index 6d71f19..a67953b 100644 --- a/scheduler_app/app/(routes)/create_meeting/_components/meetingForm.js +++ b/scheduler_app/app/(routes)/create_meeting/_components/meetingForm.js @@ -1,45 +1,80 @@ +"use client" import { Input } from '@/components/ui/input' import { ChevronLeft } from 'lucide-react' -import React from 'react' +import React, { useEffect, useState } from 'react' import {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger,} from "@/components/ui/dropdown-menu" import LocationOption from '@/app/_utils/LocationOption' import Image from 'next/image' +import { Button } from '@/components/ui/button' +import Link from 'next/link' +import ThemeOption from '@/app/_utils/ThemeOption' + +const MeetingForm = ({setFormEvent}) => { + const [themeColor, setThemeColor] = useState(); + + //set state for each event + const [eventName, setEventName] = useState(); + const [timeDuration, setTimeDuration] = useState(30); + const [locationMeeting, setLocationMeeting] = useState(); + const [urlMeeting, setUrlMeeting] = useState(); -const MeetingForm = () => { + useEffect(() => { + setFormEvent({ + eventName: eventName, + timeDuration: timeDuration, + locationMeeting: locationMeeting, + urlMeeting: urlMeeting, + themeColor: themeColor + }) + }, [eventName, timeDuration, locationMeeting, urlMeeting, themeColor]) + + + return (
-

Go back

+

Go back

Create New Event


Event Name *

- -

Meeting Length *

+ setEventName(ev.target.value)} placeholder="Enter your event/meeting name" className='text-sm'/> +

Time Duration *

- + - 15 minutes - 30 minutes - 45 minutes - 60 minutes + setTimeDuration(15)}>15 minutes + setTimeDuration(30)}>30 minutes + setTimeDuration(45)}>45 minutes + setTimeDuration(60)}>60 minutes

Location *

{LocationOption.map((option, index) => ( -
+
setLocationMeeting(option.name)} className={`border rounded-md flex flex-col justify-center items-center text-center p-2 hover:bg-gray-200 cursor-pointer ${locationMeeting == option.name && 'bg-gray-200'}`}> {option.name}/

{option.name}

))}
-

Add url

- + {locationMeeting && +
+

Add {locationMeeting} url *

+ setUrlMeeting(ev.target.value)} placeholder='Add url' className='text-sm'/> +
+ } +

Select Color

+
+ {ThemeOption.map((color,index) => ( +
setThemeColor(color)} className={`h-6 w-6 rounded-full ${themeColor == color && 'border-2 border-black'}`} style={{backgroundColor:color}}>
+ ))} +
+
) } diff --git a/scheduler_app/app/(routes)/create_meeting/_components/previewMeeting.js b/scheduler_app/app/(routes)/create_meeting/_components/previewMeeting.js new file mode 100644 index 0000000..79af2dc --- /dev/null +++ b/scheduler_app/app/(routes)/create_meeting/_components/previewMeeting.js @@ -0,0 +1,9 @@ +import React from 'react' + +const PreviewMeeting = () => { + return ( +
This is a preview meeting section
+ ) +} + +export default PreviewMeeting \ No newline at end of file diff --git a/scheduler_app/app/(routes)/create_meeting/page.js b/scheduler_app/app/(routes)/create_meeting/page.js index 735724c..47c5cd5 100644 --- a/scheduler_app/app/(routes)/create_meeting/page.js +++ b/scheduler_app/app/(routes)/create_meeting/page.js @@ -1,13 +1,19 @@ -import React from 'react' +"use client" +import React, { useState } from 'react' import MeetingForm from './_components/meetingForm' +import PreviewMeeting from './_components/previewMeeting'; const CreateMeeting = () => { + const [formEvent, setFormEvent] = useState(); + return (
- + setFormEvent(value)}/> +
+
+
-
) } diff --git a/scheduler_app/app/_utils/ThemeOption.js b/scheduler_app/app/_utils/ThemeOption.js new file mode 100644 index 0000000..ed663d0 --- /dev/null +++ b/scheduler_app/app/_utils/ThemeOption.js @@ -0,0 +1,11 @@ +export default [ + '#E90133', + '#0072B1', + '#FFC82D', + '#EB7124', + '#55A61D', + '#7F139A', + '#E97FA7', + '#94774D', + '#84898C', +] \ No newline at end of file