-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b133caa
commit 4c79ecd
Showing
4 changed files
with
143 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
"fresh-atom": "jsr:@elsoul/[email protected]", | ||
"fresh-i18n": "jsr:@elsoul/[email protected]", | ||
"fresh-theme": "jsr:@elsoul/[email protected]", | ||
"fresh-sitemap": "jsr:@elsoul/[email protected].0", | ||
"fresh-sitemap": "jsr:@elsoul/[email protected].1", | ||
"preact": "npm:[email protected]", | ||
"preact/hooks": "npm:[email protected]/hooks", | ||
"preact/jsx-runtime": "npm:[email protected]/jsx-runtime", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import Link from '@/components/utils/Link.tsx' | ||
import { useTranslation } from '@/hooks/i18n/useTranslation.ts' | ||
import { ArrowLeft, ArrowRight } from 'iconoir-react' | ||
import { asset } from 'fresh/runtime' | ||
import { cn } from '@/lib/utils.ts' | ||
import { | ||
basicBorderColor, | ||
basicTextColor, | ||
lightTextColor, | ||
} from '@/components/utils/tailwinds.ts' | ||
|
||
export type PagerProps = { | ||
pagerData: { | ||
nextPage: { | ||
title: string | ||
path: string | ||
thumbnail?: string | ||
date?: string | ||
} | undefined | ||
prevPage: { | ||
title: string | ||
path: string | ||
thumbnail?: string | ||
date?: string | ||
} | undefined | ||
} | ||
} | ||
|
||
export default function Pager({ pagerData }: PagerProps) { | ||
const t = useTranslation() | ||
return ( | ||
<> | ||
<> | ||
<div className='flex flex-col gap-4 sm:flex-row py-12'> | ||
<div className='flex-1'> | ||
{pagerData.prevPage && ( | ||
<Link | ||
href={pagerData.prevPage.path} | ||
className={cn( | ||
'block h-full w-full rounded-lg p-3', | ||
'border hover:opacity-80', | ||
basicBorderColor, | ||
)} | ||
> | ||
<div class='flex flex-row justify-between items-end gap-3'> | ||
<p | ||
className={cn( | ||
'flex flex-row items-center justify-start', | ||
'text-sm tracking-tight', | ||
basicTextColor, | ||
)} | ||
> | ||
<ArrowLeft className='mr-1.5 h-4 w-4' /> | ||
{t('common.toPrevious')} | ||
</p> | ||
{pagerData.prevPage.thumbnail && ( | ||
<img | ||
src={asset(pagerData.prevPage.thumbnail)} | ||
alt={pagerData.prevPage.title} | ||
className='w-24 rounded-sm' | ||
/> | ||
)} | ||
</div> | ||
<p | ||
className={cn( | ||
'mt-3 text-left text-xs font-light', | ||
lightTextColor, | ||
)} | ||
> | ||
{pagerData.prevPage.title} | ||
</p> | ||
</Link> | ||
)} | ||
</div> | ||
<div className='flex-1'> | ||
{pagerData.nextPage && ( | ||
<Link | ||
href={pagerData.nextPage.path} | ||
className={cn( | ||
'block h-full w-full rounded-lg p-3', | ||
'border hover:opacity-80', | ||
basicBorderColor, | ||
)} | ||
> | ||
<div class='flex flex-row justify-between items-end gap-3'> | ||
{pagerData.nextPage.thumbnail | ||
? ( | ||
<img | ||
src={asset(pagerData.nextPage.thumbnail)} | ||
alt={pagerData.nextPage.title} | ||
className='w-24 rounded-sm' | ||
/> | ||
) | ||
: <div />} | ||
<p | ||
className={cn( | ||
'flex flex-row items-center justify-end', | ||
'text-sm tracking-tight', | ||
basicTextColor, | ||
)} | ||
> | ||
{t('common.toNext')} | ||
<ArrowRight className='ml-1.5 h-4 w-4' /> | ||
</p> | ||
</div> | ||
<p | ||
className={cn( | ||
'mt-3 text-right text-xs font-light', | ||
lightTextColor, | ||
)} | ||
> | ||
{pagerData.nextPage.title} | ||
</p> | ||
</Link> | ||
)} | ||
</div> | ||
</div> | ||
</> | ||
</> | ||
) | ||
} |
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