Add date established to brewery page

This commit is contained in:
Aaron William Po
2023-04-23 20:31:09 -04:00
parent 58d30b605f
commit eec082e73a
11 changed files with 119 additions and 83 deletions

View File

@@ -2,7 +2,7 @@ import UserContext from '@/contexts/userContext';
import useGetBreweryPostLikeCount from '@/hooks/useGetBreweryPostLikeCount';
import BreweryPostQueryResult from '@/services/BreweryPost/types/BreweryPostQueryResult';
import { FC, useContext } from 'react';
import { Link } from 'react-daisyui';
import Link from 'next/link';
import { z } from 'zod';
import Image from 'next/image';
import BreweryPostLikeButton from './BreweryPostLikeButton';
@@ -24,17 +24,26 @@ const BreweryCard: FC<{ brewery: z.infer<typeof BreweryPostQueryResult> }> = ({
/>
)}
</figure>
<div className="card-body space-y-3">
<div className="card-body">
<div>
<h2 className="text-3xl font-bold">
<Link href={`/breweries/${brewery.id}`}>{brewery.name}</Link>
<h2 className="mb-2 text-2xl font-bold lg:text-3xl">
<Link href={`/breweries/${brewery.id}`} className="link-hover link">
{brewery.name}
</Link>
</h2>
<h3 className="text-xl font-semibold">{brewery.location}</h3>
<h3 className="text-xl font-normal lg:text-2xl">
located in {brewery.location}
</h3>
<h4 className="text-lg lg:text-xl">
est. {brewery.dateEstablished.getFullYear()}
</h4>
</div>
<div className="flex justify-between">
<span>liked by {likeCount} users</span>
{user && (
<BreweryPostLikeButton breweryPostId={brewery.id} mutateCount={mutate} />
)}
</div>
liked by {likeCount} users
{user && (
<BreweryPostLikeButton breweryPostId={brewery.id} mutateCount={mutate} />
)}
</div>
</div>
);