'use client'; import Link from 'next/link'; import React from 'react'; type Variant = 'primary' | 'ghost' | 'outline'; type CommonProps = { variant?: Variant; className?: string; children: React.ReactNode; iconRight?: React.ReactNode; }; type AsButton = CommonProps & { href?: undefined } & React.ButtonHTMLAttributes; type AsLink = CommonProps & { href: string; target?: string; rel?: string }; export function PremiumButton(props: AsButton | AsLink) { const { variant = 'primary', className = '', children, iconRight, ...rest } = props as CommonProps & Record; const cls = `btn btn-${variant} ${className}`.trim(); const inner = ( <> {children} {iconRight ?? ( )} ); if ('href' in props && props.href) { const isExternal = /^https?:/.test(props.href); if (isExternal) { return ( {inner} ); } return ( {inner} ); } return ( ); }