import { IconLabel } from '@/components/common/IconLabel';
import { LinkButton } from '@/components/common/LinkButton';
import { PageHeader } from '@/components/common/PageHeader';
import { useLink, useMessages, useSlug } from '@/components/hooks';
import { ExternalLink, Link } from '@/components/icons';

export function LinkHeader() {
  const { t, labels } = useMessages();
  const { getSlugUrl } = useSlug('link');
  const link = useLink();

  return (
    <PageHeader title={link.name} description={link.url} icon={<Link />}>
      <LinkButton href={getSlugUrl(link.slug)} target="_blank" prefetch={false} asAnchor>
        <IconLabel icon={<ExternalLink />} label={t(labels.view)} />
      </LinkButton>
    </PageHeader>
  );
}
