-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aih): implement next up from list retrieval for posts & ui (#372)
* feat(aih): implement next up resource retrieval & ui * feat(aih): implement next up resource retrieval & ui
- Loading branch information
1 parent
e1dcf42
commit 986fc16
Showing
11 changed files
with
313 additions
and
56 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
apps/ai-hero/src/app/(content)/_components/post-next-up-from-list-pagination.tsx
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
import { type List } from '@/lib/lists' | ||
import { getNextUpResourceFromList } from '@/utils/get-nextup-resource-from-list' | ||
import { ArrowRight, ChevronRight } from 'lucide-react' | ||
|
||
import { Button } from '@coursebuilder/ui' | ||
|
||
export default function PostNextUpFromListPagination({ | ||
listLoader, | ||
postId, | ||
}: { | ||
listLoader: Promise<List | null> | ||
postId: string | ||
}) { | ||
const list = React.use(listLoader) | ||
const nextUp = list && getNextUpResourceFromList(list, postId) | ||
return nextUp?.resource && nextUp?.resource?.fields?.state === 'published' ? ( | ||
<nav | ||
className="mt-8 flex w-full flex-col items-center rounded bg-gray-950 px-5 py-10 text-center" | ||
aria-label="List navigation" | ||
> | ||
<h2 className="fluid-2xl mb-3 font-semibold">Continue</h2> | ||
<ul> | ||
<li> | ||
<Button | ||
className="text-primary inline-flex items-center gap-2 text-lg lg:text-xl" | ||
asChild | ||
variant="link" | ||
> | ||
<Link href={`/${nextUp.resource.fields?.slug}`}> | ||
{nextUp.resource.fields?.title} <ArrowRight className="w-4" /> | ||
</Link> | ||
</Button> | ||
</li> | ||
</ul> | ||
</nav> | ||
) : null | ||
} |
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
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
Oops, something went wrong.