aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/ExternalLink.tsx
blob: dec0d16fe2eb27548d4ce1c0f75a2999cab73124 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Icon, Row, Text } from '@umami/react-zen';
import Link, { type LinkProps } from 'next/link';
import type { ReactNode } from 'react';
import { ExternalLink as LinkIcon } from '@/components/icons';

export function ExternalLink({
  href,
  children,
  ...props
}: LinkProps & { href: string; children: ReactNode }) {
  return (
    <Row alignItems="center" overflow="hidden" gap>
      <Text title={href} truncate>
        <Link {...props} href={href} target="_blank">
          {children}
        </Link>
      </Text>
      <Icon size="sm" strokeColor="muted">
        <LinkIcon />
      </Icon>
    </Row>
  );
}