-
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
934f177
commit eb0a531
Showing
5 changed files
with
157 additions
and
55 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
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,105 @@ | ||
import Link from '@/components/utils/Link.tsx' | ||
import { useTranslation } from '@/hooks/i18n/useTranslation.ts' | ||
import { ArrowLeft, ArrowRight } from 'iconoir-react' | ||
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 DocPager({ 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> | ||
</div> | ||
<p | ||
className={cn( | ||
'mt-2 text-left text-xs font-light', | ||
lightTextColor, | ||
)} | ||
> | ||
{t(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'> | ||
<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-2 text-right text-xs font-light', | ||
lightTextColor, | ||
)} | ||
> | ||
{t(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
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