-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
274 additions
and
362 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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 { Box } from '@/components' | ||
|
||
export default function Page() { | ||
return ( | ||
<div className='mt-8 flex w-full items-center justify-center'> | ||
<Box> | ||
<h1 className='text-header-1 font-bold text-neutral-900'> | ||
คำตอบของคุณถูกบันทึกแล้ว | ||
</h1> | ||
<hr /> | ||
<h2 className='text-subtitle text-neutral-500'>ขอบคุณสำหรับคำตอบ</h2> | ||
</Box> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import FormProvider from '@/providers/form-provider' | ||
import { getFormSchema } from '@/lib/form/get-form-schema' | ||
|
||
import { FormSchemaProvider } from '@/providers/form-schema-provider' | ||
|
||
export async function generateMetadata({ | ||
params: { id }, | ||
}: { | ||
params: { id: string } | ||
}) { | ||
const form = await getFormSchema(id) | ||
|
||
return { | ||
title: form.heading, | ||
} | ||
} | ||
|
||
export default async function FormLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode | ||
}>) { | ||
return <FormProvider>{children}</FormProvider> | ||
return ( | ||
<div className='flex size-full flex-col items-center justify-start gap-8 px-5 py-8'> | ||
<FormProvider>{children}</FormProvider> | ||
</div> | ||
) | ||
return <FormSchemaProvider>{children}</FormSchemaProvider> | ||
} |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
export default function Home() { | ||
return ( | ||
<main> | ||
<h1>Hello World!</h1> | ||
</main> | ||
) | ||
return <main>Unauthorized</main> | ||
} |
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 @@ | ||
interface BoxProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export const Box = ({ children }: BoxProps): JSX.Element => { | ||
return ( | ||
<div className='flex w-full max-w-3xl flex-col gap-5 rounded-box border-default bg-white p-10 shadow-default'> | ||
{children} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use client' | ||
|
||
import toast from 'react-hot-toast' | ||
|
||
import type { FormColumn } from '@/types' | ||
|
||
interface CheckboxProps { | ||
column: FormColumn | ||
} | ||
|
||
export const Checkbox = ({ column }: CheckboxProps): JSX.Element => { | ||
return ( | ||
<div className='flex w-full flex-col items-start justify-start'> | ||
<label className='relative flex w-full cursor-pointer select-none flex-row-reverse items-center justify-end'> | ||
<p className='ml-2 text-body-1 text-black'>{column.name}</p> | ||
<input | ||
type='checkbox' | ||
name={column.name} | ||
required={column.required} | ||
className='size-4 rounded-md' | ||
onInvalid={(e) => { | ||
e.preventDefault() | ||
toast.error('กรุณายอมรับข้อตกลง', { id: 'invalid' }) | ||
}} | ||
/> | ||
<p className='absolute -bottom-10 my-2 hidden w-full text-body-2 italic text-red-600'> | ||
จำเป็นต้องยอมรับ | ||
</p> | ||
</label> | ||
</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
Oops, something went wrong.