about summary refs log tree commit diff
path: root/bskyembed/src/components/link.tsx
blob: 7226ecf3d372d951e0bee51de75445c3782f274a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {h} from 'preact'

export function Link({
  href,
  className,
  ...props
}: {
  href: string
  className?: string
} & h.JSX.HTMLAttributes<HTMLAnchorElement>) {
  return (
    <a
      href={href.startsWith('http') ? href : `https://bsky.app${href}`}
      target="_blank"
      rel="noopener noreferrer nofollow"
      onClick={evt => evt.stopPropagation()}
      className={`cursor-pointer ${className || ''}`}
      {...props}
    />
  )
}