Files
Compass/web/components/widgets/new-tab-link.tsx
Martin Braquet ba9b3cfb06 Add pretty formatting (#29)
* Test

* Add pretty formatting

* Fix Tests

* Fix Tests

* Fix Tests

* Fix

* Add pretty formatting fix

* Fix

* Test

* Fix tests

* Clean typeckech

* Add prettier check

* Fix api tsconfig

* Fix api tsconfig

* Fix tsconfig

* Fix

* Fix

* Prettier
2026-02-20 17:32:27 +01:00

25 lines
539 B
TypeScript

import Link from 'next/link'
import {isNativeMobile} from 'web/lib/util/webview'
interface NewTabLinkProps {
href: string
children: React.ReactNode
className?: string
onClick?: () => void
}
export function NewTabLink({href, children, className, onClick}: NewTabLinkProps) {
// New tabs don't work on native apps
const isNative = isNativeMobile()
return (
<Link
href={href}
onClick={onClick}
target={isNative ? undefined : '_blank'}
className={className}
>
{children}
</Link>
)
}