mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-19 23:31:21 +02:00
Better insight into settings updates
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import classNames from 'classnames';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { Link as RouterLink } from 'react-router-dom';
|
||||
import { trackEvent } from '../../lib/analytics';
|
||||
import { Icon } from './Icon';
|
||||
|
||||
interface Props extends HTMLAttributes<HTMLAnchorElement> {
|
||||
href: string;
|
||||
event?: string;
|
||||
}
|
||||
|
||||
export function Link({ href, children, className, ...other }: Props) {
|
||||
export function Link({ href, children, className, event, ...other }: Props) {
|
||||
const isExternal = href.match(/^https?:\/\//);
|
||||
|
||||
className = classNames(className, 'relative underline hover:text-violet-600');
|
||||
@@ -19,6 +21,12 @@ export function Link({ href, children, className, ...other }: Props) {
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={classNames(className, 'pr-4 inline-flex items-center')}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
if (event != null) {
|
||||
trackEvent('link', 'click', { id: event });
|
||||
}
|
||||
}}
|
||||
{...other}
|
||||
>
|
||||
<span className="underline">{children}</span>
|
||||
|
||||
Reference in New Issue
Block a user