Skip to content

Instantly share code, notes, and snippets.

View samuelhorn's full-sized avatar
👨‍💻
jam stackin'

Samuel Horn af Rantzien samuelhorn

👨‍💻
jam stackin'
View GitHub Profile
@samuelhorn
samuelhorn / authorpage.tsx
Last active October 24, 2023 08:51
fetch posts related to author
import { createClient } from "@/prismicio";
import { filter } from "@prismicio/client";
const Author = async ({ params }: { params: { uid: string } }) => {
const client = createClient();
// Fetch the actual author
const author = await client.getByUID("blog_author", params.uid)
// Fetch all blog posts related to author
@samuelhorn
samuelhorn / menu-items-no-slicezone.tsx
Last active December 6, 2023 08:43
Menu items as Slices without SliceZone, as used in Prismic top level menu
<ul className="flex flex-col lg:items-center lg:flex-row lg:justify-center">
{layout.data.slices1.map((item, index) => {
if (item.variation === "default") {
return (
<MenuItem
key={index}
slice={item}
/>
);
} else {
@samuelhorn
samuelhorn / menu-items-slicezone.tsx
Last active December 6, 2023 08:45
Menu items rendered in SliceZone as in Prismic's sub menu within a <MenuItemWithSubmenu />
<div className="px-0 container lg:px-8 flex flex-col lg:flex-row">
<div
className="flex flex-col lg:w-[26.6666666667%] lg:py-12 gap-3 my-6 lg:my-0"
>
<SliceZone
slices="{slice.primary.sub_menu.data.slices}"
components="{components}"
/>
</div>
<ColumnSeparator />