Add dbml, minor tweaks to beer style page

This commit is contained in:
Aaron William Po
2023-09-23 22:32:15 -04:00
parent 390ac8daf9
commit cb26df286a
8 changed files with 121 additions and 9 deletions

View File

@@ -0,0 +1,33 @@
import getBeerStyleById from '@/services/BeerStyles/getBeerStyleById';
import BeerStyleQueryResult from '@/services/BeerStyles/schema/BeerStyleQueryResult';
import { GetServerSideProps, NextPage } from 'next';
import { z } from 'zod';
interface BeerStylePageProps {
beerStyle: z.infer<typeof BeerStyleQueryResult>;
}
const BeerStylePage: NextPage<BeerStylePageProps> = ({ beerStyle }) => {
return (
<div>
<h1>{beerStyle.name}</h1>
<p>{beerStyle.description}</p>
</div>
);
};
export default BeerStylePage;
export const getServerSideProps: GetServerSideProps<BeerStylePageProps> = async (
context,
) => {
const beerStyle = await getBeerStyleById(context.params!.id! as string);
if (!beerStyle) {
return {
notFound: true,
};
}
return { props: { beerStyle: JSON.parse(JSON.stringify(beerStyle)) } };
};

View File

@@ -38,7 +38,7 @@ const BeerStylePage: NextPage = () => {
<header className="my-10 flex justify-between lg:flex-row">
<div>
<h1 className="text-4xl font-bold lg:text-6xl">The Biergarten App</h1>
<h2 className="text-2xl font-bold lg:text-4xl">Types</h2>
<h2 className="text-2xl font-bold lg:text-4xl">Styles</h2>
</div>
</header>
<div className="grid gap-6 xl:grid-cols-2">