Update styles to be more mobile friendly, add favicon

This commit is contained in:
Aaron William Po
2023-04-18 21:40:34 -04:00
parent 95778333df
commit dffbc5cdfb
21 changed files with 83 additions and 51 deletions

6
public/favicon/about.txt Normal file
View File

@@ -0,0 +1,6 @@
This favicon was generated using the following graphics from Twitter Twemoji:
- Graphics Title: 1f37a.svg
- Graphics Author: Copyright 2020 Twitter, Inc and other contributors (https://github.com/twitter/twemoji)
- Graphics Source: https://github.com/twitter/twemoji/blob/master/assets/svg/1f37a.svg
- Graphics License: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

BIN
public/favicon/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

View File

@@ -40,10 +40,7 @@ const BeerInfoHeader: FC<{
</header> </header>
{isPostOwner && ( {isPostOwner && (
<div className="tooltip tooltip-left" data-tip={`Edit '${beerPost.name}'`}> <div className="tooltip tooltip-left" data-tip={`Edit '${beerPost.name}'`}>
<Link <Link href={`/beers/${beerPost.id}/edit`} className="btn-ghost btn-xs btn">
href={`/beers/${beerPost.id}/edit`}
className="btn-outline btn-sm btn"
>
<FaRegEdit className="text-xl" /> <FaRegEdit className="text-xl" />
</Link> </Link>
</div> </div>

View File

@@ -52,7 +52,7 @@ const BeerPostCommentsSection: FC<BeerPostCommentsSectionProps> = ({ beerPost })
{user ? ( {user ? (
<BeerCommentForm beerPost={beerPost} mutate={mutate} /> <BeerCommentForm beerPost={beerPost} mutate={mutate} />
) : ( ) : (
<div className="flex h-full flex-col items-center justify-center"> <div className="flex h-52 flex-col items-center justify-center">
<span className="text-lg font-bold">Log in to leave a comment.</span> <span className="text-lg font-bold">Log in to leave a comment.</span>
</div> </div>
)} )}
@@ -73,7 +73,7 @@ const BeerPostCommentsSection: FC<BeerPostCommentsSectionProps> = ({ beerPost })
{!!comments.length && ( {!!comments.length && (
<div className="card bg-base-300 pb-6"> <div className="card bg-base-300 pb-6">
{comments.map((comment, index) => { {comments.map((comment, index) => {
const isLastComment = index === comments.length - 1; const isPenulitmateComment = index === comments.length - 2;
/** /**
* Attach a ref to the last comment in the list. When it comes into * Attach a ref to the last comment in the list. When it comes into
@@ -81,7 +81,7 @@ const BeerPostCommentsSection: FC<BeerPostCommentsSectionProps> = ({ beerPost })
*/ */
return ( return (
<div <div
ref={isLastComment ? lastCommentRef : undefined} ref={isPenulitmateComment ? lastCommentRef : undefined}
key={comment.id} key={comment.id}
> >
<CommentCardBody comment={comment} mutate={mutate} /> <CommentCardBody comment={comment} mutate={mutate} />
@@ -94,9 +94,7 @@ const BeerPostCommentsSection: FC<BeerPostCommentsSectionProps> = ({ beerPost })
* If there are more comments to load, show a loading component with a * If there are more comments to load, show a loading component with a
* skeleton loader and a loading spinner. * skeleton loader and a loading spinner.
*/ */
!!isLoadingMore && ( !!isLoadingMore && <LoadingComponent length={PAGE_SIZE} />
<LoadingComponent length={Math.floor(PAGE_SIZE / 2)} />
)
} }
{ {

View File

@@ -20,13 +20,13 @@ const BeerRecommendations: FunctionComponent<BeerRecommendationsProps> = ({
</h2> </h2>
</Link> </Link>
<Link href={`/breweries/${beerPost.brewery.id}`} className="link-hover"> <Link href={`/breweries/${beerPost.brewery.id}`} className="link-hover">
<p className="truncate text-lg font-semibold lg:text-xl"> <p className="text-md truncate font-semibold lg:text-xl">
{beerPost.brewery.name} {beerPost.brewery.name}
</p> </p>
</Link> </Link>
</div> </div>
<div className="text-md space-x-3 lg:text-lg"> <div className="space-x-3 text-sm lg:text-lg">
<span>{beerPost.abv}% ABV</span> <span>{beerPost.abv}% ABV</span>
<span>{beerPost.ibu} IBU</span> <span>{beerPost.ibu} IBU</span>
</div> </div>

View File

@@ -35,7 +35,7 @@ const CommentCardDropdown: FC<CommentCardProps> = ({ comment, mutate }) => {
}; };
return ( return (
<div className="dropdown"> <div className="dropdown dropdown-end">
<label tabIndex={0} className="btn-ghost btn-sm btn m-1"> <label tabIndex={0} className="btn-ghost btn-sm btn m-1">
<FaEllipsisH /> <FaEllipsisH />
</label> </label>
@@ -45,7 +45,12 @@ const CommentCardDropdown: FC<CommentCardProps> = ({ comment, mutate }) => {
> >
<li> <li>
{isCommentOwner ? ( {isCommentOwner ? (
<button onClick={handleDelete}>Delete</button> <>
<button type="button">Edit</button>
<button type="button" onClick={handleDelete}>
Delete
</button>
</>
) : ( ) : (
<button>Report</button> <button>Report</button>
)} )}

View File

@@ -27,12 +27,12 @@ const BeerCard: FC<{ post: z.infer<typeof beerPostQueryResult> }> = ({ post }) =
<div className="card-body justify-between"> <div className="card-body justify-between">
<div className="space-y-1"> <div className="space-y-1">
<Link href={`/beers/${post.id}`}> <Link href={`/beers/${post.id}`}>
<h2 className="link-hover link overflow-hidden text-ellipsis whitespace-normal text-2xl font-bold lg:text-3xl"> <h2 className="link-hover link overflow-hidden whitespace-normal text-2xl font-bold lg:truncate lg:text-3xl">
{post.name} {post.name}
</h2> </h2>
</Link> </Link>
<Link href={`/breweries/${post.brewery.id}`}> <Link href={`/breweries/${post.brewery.id}`}>
<h3 className="text-md link-hover link overflow-hidden text-ellipsis lg:text-xl"> <h3 className="text-md link-hover link whitespace-normal lg:truncate lg:text-xl">
{post.brewery.name} {post.brewery.name}
</h3> </h3>
</Link> </Link>

View File

@@ -48,8 +48,8 @@ const RegisterUserForm: FC = () => {
)} )}
</div> </div>
<div> <div>
<div className="flex flex-row space-x-3"> <div className="flex flex-col lg:flex-row lg:space-x-3">
<div className="w-[50%]"> <div className="lg:w-[50%]">
<FormInfo> <FormInfo>
<FormLabel htmlFor="firstName">First name</FormLabel> <FormLabel htmlFor="firstName">First name</FormLabel>
<FormError>{errors.firstName?.message}</FormError> <FormError>{errors.firstName?.message}</FormError>
@@ -66,7 +66,7 @@ const RegisterUserForm: FC = () => {
</FormSegment> </FormSegment>
</div> </div>
<div className="w-[50%]"> <div className="lg:w-[50%]">
<FormInfo> <FormInfo>
<FormLabel htmlFor="lastName">Last name</FormLabel> <FormLabel htmlFor="lastName">Last name</FormLabel>
<FormError>{errors.lastName?.message}</FormError> <FormError>{errors.lastName?.message}</FormError>
@@ -84,8 +84,8 @@ const RegisterUserForm: FC = () => {
</div> </div>
</div> </div>
<div className="flex flex-row space-x-3"> <div className="flex flex-col lg:flex-row lg:space-x-3">
<div className="w-[50%]"> <div className="lg:w-[50%]">
<FormInfo> <FormInfo>
<FormLabel htmlFor="email">email</FormLabel> <FormLabel htmlFor="email">email</FormLabel>
<FormError>{errors.email?.message}</FormError> <FormError>{errors.email?.message}</FormError>
@@ -101,7 +101,7 @@ const RegisterUserForm: FC = () => {
/> />
</FormSegment> </FormSegment>
</div> </div>
<div className="w-[50%]"> <div className="lg:w-[50%]">
<FormInfo> <FormInfo>
<FormLabel htmlFor="username">username</FormLabel> <FormLabel htmlFor="username">username</FormLabel>
<FormError>{errors.username?.message}</FormError> <FormError>{errors.username?.message}</FormError>
@@ -119,8 +119,8 @@ const RegisterUserForm: FC = () => {
</div> </div>
</div> </div>
<div className="flex flex-row space-x-3"> <div className="flex flex-col lg:flex-row lg:space-x-3">
<div className="w-[50%]"> <div className="lg:w-[50%]">
<FormInfo> <FormInfo>
<FormLabel htmlFor="password">password</FormLabel> <FormLabel htmlFor="password">password</FormLabel>
<FormError>{errors.password?.message}</FormError> <FormError>{errors.password?.message}</FormError>
@@ -136,7 +136,7 @@ const RegisterUserForm: FC = () => {
/> />
</FormSegment> </FormSegment>
</div> </div>
<div className="w-[50%]"> <div className="lg:w-[50%]">
<FormInfo> <FormInfo>
<FormLabel htmlFor="confirmPassword">confirm password</FormLabel> <FormLabel htmlFor="confirmPassword">confirm password</FormLabel>
<FormError>{errors.confirmPassword?.message}</FormError> <FormError>{errors.confirmPassword?.message}</FormError>

View File

@@ -5,7 +5,7 @@ const Layout: FC<{ children: ReactNode }> = ({ children }) => {
return ( return (
<div className="flex h-screen flex-col"> <div className="flex h-screen flex-col">
<Navbar /> <Navbar />
<div className="top-0 h-full flex-1 overflow-x-auto animate-in fade-in"> <div className="top-0 h-full w-screen flex-1 overflow-x-auto animate-in fade-in">
{children} {children}
</div> </div>
</div> </div>

View File

@@ -19,9 +19,9 @@ const FormPageLayout: FC<FormPageLayoutProps> = ({
backLinkText, backLinkText,
}) => { }) => {
return ( return (
<div className="align-center my-20 flex h-fit flex-col items-center justify-center"> <div className="align-center my-20 flex flex-col items-center justify-center">
<div className="w-8/12"> <div className="w-10/12 lg:w-8/12 2xl:w-6/12">
<div className="tooltip tooltip-bottom absolute" data-tip={backLinkText}> <div className="tooltip tooltip-right" data-tip={backLinkText}>
<Link href={backLink} className="btn-ghost btn-sm btn p-0"> <Link href={backLink} className="btn-ghost btn-sm btn p-0">
<BiArrowBack className="text-xl" /> <BiArrowBack className="text-xl" />
</Link> </Link>
@@ -30,7 +30,7 @@ const FormPageLayout: FC<FormPageLayoutProps> = ({
{headingIcon({ className: 'text-4xl' })}{' '} {headingIcon({ className: 'text-4xl' })}{' '}
<h1 className="text-3xl font-bold">{headingText}</h1> <h1 className="text-3xl font-bold">{headingText}</h1>
</div> </div>
<div>{FormComponent}</div> <div className="mt-3">{FormComponent}</div>
</div> </div>
</div> </div>
); );

View File

@@ -21,6 +21,7 @@ export default function App({ Component, pageProps }: AppProps) {
} }
`} `}
</style> </style>
<UserContext.Provider value={{ user, isLoading, error, mutate }}> <UserContext.Provider value={{ user, isLoading, error, mutate }}>
<Component {...pageProps} /> <Component {...pageProps} />
</UserContext.Provider> </UserContext.Provider>

View File

@@ -3,7 +3,26 @@ import { Html, Head, Main, NextScript } from 'next/document';
export default function Document() { export default function Document() {
return ( return (
<Html lang="en"> <Html lang="en">
<Head /> <Head>
<link
rel="apple-touch-icon"
sizes="180x180"
href="favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="favicon/favicon-16x16.png"
/>
<link rel="manifest" href="favicon/site.webmanifest" />
</Head>
<body> <body>
<Main /> <Main />
<NextScript /> <NextScript />

View File

@@ -47,7 +47,8 @@ const BeerByIdPage: NextPage<BeerPageProps> = ({ beerPost, beerRecommendations }
infiniteLoop infiniteLoop
showThumbs={false} showThumbs={false}
> >
{beerPost.beerImages.map((image, index) => ( {beerPost.beerImages.length
? beerPost.beerImages.map((image, index) => (
<div key={image.id} id={`image-${index}}`} className="w-full"> <div key={image.id} id={`image-${index}}`} className="w-full">
<Image <Image
alt={image.alt} alt={image.alt}
@@ -57,6 +58,9 @@ const BeerByIdPage: NextPage<BeerPageProps> = ({ beerPost, beerRecommendations }
className="h-[42rem] w-full object-cover" className="h-[42rem] w-full object-cover"
/> />
</div> </div>
))
: Array.from({ length: 1 }).map((_, i) => (
<div className="h-[42rem] bg-base-300" key={i} />
))} ))}
</Carousel> </Carousel>

View File

@@ -11,7 +11,7 @@ import Spinner from '@/components/ui/Spinner';
import useBeerPosts from '@/hooks/useBeerPosts'; import useBeerPosts from '@/hooks/useBeerPosts';
import BeerPostLoadingCard from '@/components/BeerIndex/BeerPostLoadingCard'; import BeerPostLoadingCard from '@/components/BeerIndex/BeerPostLoadingCard';
import { FaArrowUp } from 'react-icons/fa'; import { FaArrowUp, FaPlus } from 'react-icons/fa';
const BeerPage: NextPage = () => { const BeerPage: NextPage = () => {
const { user } = useContext(UserContext); const { user } = useContext(UserContext);
@@ -39,14 +39,15 @@ const BeerPage: NextPage = () => {
</Head> </Head>
<div className="flex items-center justify-center bg-base-100" ref={pageRef}> <div className="flex items-center justify-center bg-base-100" ref={pageRef}>
<div className="my-10 flex w-11/12 flex-col space-y-4 lg:w-8/12 2xl:w-7/12"> <div className="my-10 flex w-11/12 flex-col space-y-4 lg:w-8/12 2xl:w-7/12">
<header className="my-10 flex flex-col justify-between lg:flex-row"> <header className="my-10 flex justify-between lg:flex-row">
<div className="space-y-2">
<h1 className="text-6xl font-bold">The Biergarten Index</h1> <h1 className="text-6xl font-bold">The Biergarten Index</h1>
</div>
{!!user && ( {!!user && (
<div className="mt-6 lg:mt-0"> <div
<Link href="/beers/create" className="btn-primary btn"> className="tooltip tooltip-left h-full"
Create a new beer post data-tip="Create a new beer post"
>
<Link href="/beers/create" className="btn-ghost btn-sm btn">
<FaPlus />
</Link> </Link>
</div> </div>
)} )}

View File

@@ -16,7 +16,7 @@ const Home: NextPage = () => {
The Biergarten App The Biergarten App
</h1> </h1>
<p className="mt-4 text-lg lg:text-2xl"> <p className="mt-4 text-lg lg:text-2xl">
An app for beer lovers to share their favorite brews and breweries with An app for beer lovers to share their favourite brews and breweries with
like-minded people online. like-minded people online.
</p> </p>
</div> </div>