-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from jamesqquick/add-tag-pages
✨ tag pages display correctly
- Loading branch information
Showing
5 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,43 @@ | ||
import { redirect, type LoaderArgs } from '@remix-run/node'; | ||
import { useLoaderData } from '@remix-run/react'; | ||
import { EpisodeGrid } from '~/components/EpisodeGrid/EpisodeGrid'; | ||
import { Newsletter } from '~/components/Newsletter'; | ||
import { VerticalDivider } from '~/components/VerticalDivider'; | ||
import { getClient } from '~/lib/sanity'; | ||
import { TagQuery } from '~/queries/Queries'; | ||
|
||
export const loader = async ({ params }: LoaderArgs) => { | ||
const slug = params.slug; | ||
const sanityClient = getClient(); | ||
const content = await sanityClient.fetch(TagQuery, { slug }); | ||
//Todo: do we have a preferred solution for a page that doesn't exist? | ||
if (!content) return redirect('/'); | ||
|
||
return { content, slug }; | ||
}; | ||
|
||
export default function Tag() { | ||
return <div>Tags</div>; | ||
const { content } = useLoaderData(); | ||
|
||
const { title, episodes } = content; | ||
|
||
return ( | ||
<div> | ||
<h3 className="text-center text-2xl italic uppercase">Tagged</h3> | ||
{title && ( | ||
<h1 className="text-white text-center font-sans text-[60px] md:text-[85px] font-black leading-none m-0 p-0 relative z-episodeTitle"> | ||
{title} | ||
</h1> | ||
)} | ||
{episodes ? ( | ||
<EpisodeGrid episodes={episodes} header={''} /> | ||
) : ( | ||
<p> | ||
<em>No Episodes Found</em> | ||
</p> | ||
)} | ||
<VerticalDivider /> | ||
<Newsletter /> | ||
</div> | ||
); | ||
} |
e3e073c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
compressedfm – ./
compressedfm-lemon.vercel.app
compressedfm-ahhacreative.vercel.app
compressed.fm
www.compressed.fm
compressedfm-git-main-ahhacreative.vercel.app