Skip to content

Commit ee19126

Browse files
authored
Merge pull request #38 from coderKrysio/dev-1
updated components
2 parents 6cae64d + cdfde43 commit ee19126

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

components/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Form = ({ setFormData }: any) => {
2727
const renderForm = () => {
2828
return (
2929
<form
30-
className="w-[350px] min-h-[350px] text-xl flex flex-col justify-start items-center"
30+
className="w-[350px] min-h-[350px] text-xl flex flex-col justify-start items-center max-[500px]:w-[300px]"
3131
onSubmit={(e) => {
3232
e.preventDefault()
3333
}}

components/GetForm.tsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Form from './Form'
33
import Navbar from './Navbar'
44
import { svgSrc, timeIntervals } from '@/lib/utils'
55
import Link from 'next/link'
6+
import { useRouter } from 'next/navigation'
67
interface RoomCode {
78
roomCode: string
89
}
@@ -14,44 +15,58 @@ interface FormData {
1415
}
1516

1617
const GetForm = ({ roomCode }: RoomCode) => {
18+
const router = useRouter()
19+
const [showError, setShowError] = useState<boolean>(false);
1720
const [formData, setFormData] = useState<FormData>({
1821
name: '',
1922
roomCode: roomCode,
2023
intervals: [timeIntervals]
2124
})
2225

26+
const checkFields = () => {
27+
if(formData.name === '') setShowError(true);
28+
else {
29+
setShowError(false)
30+
router.push(`/${roomCode}/result`)
31+
}
32+
}
33+
2334
console.log(formData)
2435

2536
return (
26-
<div className="w-screen min-h-screen flex flex-col justify-center items-center text-white py-[70px]">
37+
<div className="w-screen min-h-screen flex flex-col justify-center items-center text-white pb-[70px] pt-[90px]">
2738
<Navbar />
2839

29-
<div className="relative w-fit border-2 border-white ml-6 p-8 rounded-2xl flex justify-start items-start bg-[#16161a]">
40+
<div className="relative w-fit border-2 border-white ml-6 p-8 rounded-2xl flex justify-start items-start bg-[#16161a] max-[985px]:flex-col max-[500px]:p-4 max-[500px]:ml-0 max-[500px]:py-8">
3041
<div>
3142
<p className="text-2xl text-[#d4d4d4] mb-[20px]">Room Code: {roomCode}</p>
3243

3344
<Form setFormData={setFormData} />
3445
</div>
3546

36-
<div className="mt-[20px] ml-[20px]">
47+
<div className="mt-[20px] ml-[20px] max-[985px]:hidden">
3748
<iframe
3849
className="border-none w-[450px] h-[275px] z-[-1]"
3950
src={svgSrc}
4051
></iframe>
4152
</div>
4253

43-
<div className="absolute bottom-0 right-0 m-8 mb-[42px] flex gap-6">
44-
<Link className="py-2 px-5 border-[3px] border-white rounded-lg text-xl font-medium hover:font-semibold hover:border-[#48d399] hover:text-[#48d399]"
45-
href={`/${roomCode}/result`}
54+
<div className="absolute bottom-0 right-0 m-8 mb-[42px] flex gap-6 max-[985px]:relative max-[985px]:my-0 max-[985px]:mx-auto">
55+
<button className="py-2 px-5 border-[3px] border-white rounded-lg text-xl font-medium hover:font-semibold hover:border-[#48d399] hover:text-[#48d399]"
56+
onClick={() => checkFields()}
4657
>
4758
Submit
48-
</Link>
59+
</button>
4960

5061
<Link className="py-2 px-5 border-[3px] border-white rounded-lg text-xl font-medium hover:font-semibold hover:border-[#48d399] hover:text-[#48d399]"
5162
href={`/${roomCode}/result`}
5263
>
5364
Result
5465
</Link>
66+
67+
{showError && <p
68+
className='text-xl text-[#db696d] font-semibold tracking-wide w-max absolute -bottom-[35px] left-1/2 -translate-x-1/2'
69+
>Name field is empty !</p>}
5570
</div>
5671
</div>
5772
</div>

components/LandingPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const LandingPage = () => {
1313
Get Intervals
1414
</h1>
1515

16-
<p className="text-xl">
16+
<p className="text-xl text-center">
1717
Unite Your Free Time: Find Common Slots Together!
1818
</p>
1919

components/ListIntervals.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const ListIntervals = ({ addInterval, removeInterval, setFormData }: any) => {
4949

5050
<div
5151
id="interval"
52-
className="flex justify-center items-center gap-[10px]"
52+
className="relative flex justify-center items-center gap-[10px] max-[500px]:mb-[40px]"
5353
>
5454
<input
5555
type="time"
@@ -69,7 +69,9 @@ const ListIntervals = ({ addInterval, removeInterval, setFormData }: any) => {
6969
className={`border-2 border-white text-black text-[24px] font-semibold rounded-lg py-[3px] px-4 m-1 focus:outline focus:outline-2 focus:outline-[#48d399] focus:border-[#48d399] focus:bg-transparent focus:text-white ${rajdhani.className}`}
7070
/>
7171

72-
<div>
72+
<div
73+
className='flex max-[500px]:absolute max-[500px]:-bottom-full'
74+
>
7375
<button
7476
className="w-[35px] h-[35px] rounded-[25px] ml-[20px]"
7577
onClick={() => addInterval()}
@@ -101,7 +103,7 @@ const ListIntervals = ({ addInterval, removeInterval, setFormData }: any) => {
101103
</div>
102104

103105
{errorMsg != '' ? (
104-
<p className="font-medium text-[#db696d]">{errorMsg}</p>
106+
<p className="text-center font-medium text-[#db696d] max-[500px]:mt-[20px]">{errorMsg}</p>
105107
) : (
106108
<></>
107109
)}

components/Results.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ const Results = ({ roomCode }: RoomCode) => {
4747

4848
<Timeline />
4949

50+
<button
51+
className='min-[1470px]:hidden text-2xl tracking-wide font-medium py-2 px-5 border-2 border-white rounded-lg outline outline-2 outline-transparent hover:outline-white'
52+
53+
>Show Timeline</button>
54+
5055
<p className="text-3xl text-[#d4d4d4] font-medium pb-3 my-4">
5156
Members Info
5257
</p>
5358

54-
<div className="max-w[1200px] grid grid-flow-row grid-cols-3 justify-center items-start gap-[70px]">
59+
<div className="max-w[1200px] grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 justify-center items-start gap-[70px]">
5560
{membersData.map((values: MemberData, id: number) => (
5661
<MemberInfo
5762
name={values.name}

components/Timeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const Timeline = () => {
3636
}
3737

3838
return (
39-
<div className="my-[50px] flex p-0 text-center">
39+
<div className="my-[50px] flex p-0 text-center max-[1470px]:scale-[0.253]">
4040
{timeline.map((time: number, index: number) => (
4141
<div
4242
key={index}

0 commit comments

Comments
 (0)