mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-15 10:43:07 +00:00
- wizardPreviousHref em wizardActionChain para todos os elos B98 - Avanço encadeado com router.push; Voltar no chrome com replace - Testes unitários para href anterior e navegação pending Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
35 lines
903 B
TypeScript
35 lines
903 B
TypeScript
'use client'
|
|
|
|
import type { ComponentPropsWithoutRef } from 'react'
|
|
|
|
import {
|
|
CampaignTransitionAnchor,
|
|
useCampaignListTransition,
|
|
} from '@/components/campaign/shared/CampaignListPending'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
/**
|
|
* Wizard route navigation with shared list pending: drives the layout boundary
|
|
* and locks sibling triggers while the RSC payload loads.
|
|
*/
|
|
export const CampaignWizardNavLink = ({
|
|
href,
|
|
replace = false,
|
|
className,
|
|
children,
|
|
...anchorProps
|
|
}: Omit<ComponentPropsWithoutRef<'a'>, 'href'> & { href: string; replace?: boolean }) => {
|
|
const { isPending } = useCampaignListTransition()
|
|
|
|
return (
|
|
<CampaignTransitionAnchor
|
|
href={href}
|
|
replace={replace}
|
|
className={cn(isPending && 'pointer-events-none', className)}
|
|
aria-busy={isPending || undefined}
|
|
{...anchorProps}
|
|
>
|
|
{children}
|
|
</CampaignTransitionAnchor>
|
|
)
|
|
}
|