diff --git a/apps/web/app/ius/[slug]/page.tsx b/apps/web/app/ius/[slug]/page.tsx index 6d66ae7..2762689 100644 --- a/apps/web/app/ius/[slug]/page.tsx +++ b/apps/web/app/ius/[slug]/page.tsx @@ -1,7 +1,6 @@ import * as apiIUS from '@/api/ius/query'; import type { Request } from '@/api/ius/types'; -import { mapFieldTypeElement } from '@/config/elements'; -import { Background, Button, Content, ElementContainer } from 'ui'; +import { Form } from '@/components/Form'; type Props = { params: { slug: string }; @@ -9,47 +8,12 @@ type Props = { }; export default async function Page(props: Props) { - const { data, metaData } = await getData({ + const data = await getData({ searchParams: props.searchParams, slug: props.params.slug, }); - return ( - - -
- {Object.keys(metaData).map((name) => { - const { fieldType, visible } = metaData[name]; - - if (!visible) return false; - - const Element = mapFieldTypeElement[fieldType]; - - return ( - - - - ); - })} -
-
- - - -
-
-
- ); + return
; } async function getData(params: Request) { diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index cd884e0..14de0b8 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -2,7 +2,7 @@ import './globals.css'; import { Auth, Logo } from '@/components/layout'; import type { Metadata } from 'next'; import { Inter } from 'next/font/google'; -import { Header } from 'ui'; +import { Content, Header } from 'ui'; const inter = Inter({ subsets: ['latin'] }); @@ -19,7 +19,7 @@ export default function RootLayout({ children }: { readonly children: React.Reac - {children} + {children} ); diff --git a/apps/web/components/Form.tsx b/apps/web/components/Form.tsx new file mode 100644 index 0000000..dba97e8 --- /dev/null +++ b/apps/web/components/Form.tsx @@ -0,0 +1,45 @@ +import type { ResponseGetData, ResponseMetaData } from '@/api/ius/types'; +import { mapFieldTypeElement } from '@/config/elements'; +import { Background, Button, ElementContainer } from 'ui'; + +type Props = { + readonly data: ResponseGetData; + readonly metaData: ResponseMetaData; +}; + +export function Form({ data, metaData }: Props) { + return ( + +
+ {Object.keys(metaData).map((name) => { + const { fieldType, visible } = metaData[name]; + + if (!visible) return false; + + const Element = mapFieldTypeElement[fieldType]; + + return ( + + + + ); + })} +
+
+ + + +
+
+ ); +} diff --git a/packages/ui/background.tsx b/packages/ui/background.tsx index 8360d07..86d5825 100644 --- a/packages/ui/background.tsx +++ b/packages/ui/background.tsx @@ -1,5 +1,9 @@ import type { PropsWithChildren } from 'react'; export function Background({ children }: PropsWithChildren) { - return
{children}
; + return ( +
+ {children} +
+ ); } diff --git a/packages/ui/container.tsx b/packages/ui/container.tsx index 0b6e8f0..66242b5 100644 --- a/packages/ui/container.tsx +++ b/packages/ui/container.tsx @@ -4,7 +4,7 @@ export type ContainerProps = HTMLAttributes & PropsWithChildren; export function ElementContainer({ children, id, title, ...props }: ContainerProps) { return ( -
+