Files
veilix.app/src/ui/marketing/GetVpnLink.tsx
T

37 lines
850 B
TypeScript
Raw Normal View History

2026-10-22 04:53:15 +02:00
'use client'
import type { ReactNode } from 'react'
/**
* «Получить VPN» (07-frontend, раздел 7.6): на странице с блоком цен (#prices) — к нему,
* на остальных — на /pricing. Без JavaScript ссылка всегда ведёт на /pricing.
*/
export function GetVpnLink({
href,
className,
onNavigate,
children,
}: {
href: string
className: string
onNavigate?: () => void
children: ReactNode
}) {
return (
<a
href={href}
className={className}
onClick={(event) => {
const prices = document.getElementById('prices')
if (prices) {
event.preventDefault()
prices.scrollIntoView()
history.replaceState(null, '', '#prices')
}
onNavigate?.()
}}
>
{children}
</a>
)
}