Skip to content

Commit

Permalink
feat: add titles and descriptions for the create and update pages
Browse files Browse the repository at this point in the history
  • Loading branch information
harryle95 committed May 12, 2024
1 parent 278c60b commit 972c107
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/components/factory/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,31 @@ const createPages = <T extends AbstractDataType>(
);
};
const CreatePage: React.FC<{}> = () => {
return <FormComponent method="POST">{components}</FormComponent>;
return (
<styled.div themeName="PageRoot">
<styled.h1 themeName="PageTitle">{title}</styled.h1>
<styled.p themeName="PageDescription">
Create a new {title} entry by filling out the form below.
</styled.p>
<FormComponent method="POST">{components}</FormComponent>;
</styled.div>
);
};
const UpdatePage: React.FC<{}> = () => {
const data = useLoaderData() as T | null;
const updateComponents = React.useMemo(
() => createInputArray(schema, [], data),
[JSON.stringify(data)]
);
return <FormComponent method="PUT">{updateComponents}</FormComponent>;
return (
<styled.div themeName="PageRoot">
<styled.h1 themeName="PageTitle">{title}</styled.h1>
<styled.p themeName="PageDescription">
Update the current {title} entry by filling out the form below.
</styled.p>
<FormComponent method="PUT">{updateComponents}</FormComponent>;
</styled.div>
);
};
return [DetailPage, CreatePage, UpdatePage];
};
Expand Down

0 comments on commit 972c107

Please sign in to comment.