mirror of
https://github.com/zadam/trilium.git
synced 2025-12-19 22:59:53 +01:00
27 lines
718 B
TypeScript
27 lines
718 B
TypeScript
import { ComponentChild } from "preact";
|
|
import { CommandNames } from "../../components/app_context";
|
|
|
|
interface LinkButtonProps {
|
|
onClick?: () => void;
|
|
text: ComponentChild;
|
|
triggerCommand?: CommandNames;
|
|
}
|
|
|
|
export default function LinkButton({ onClick, text, triggerCommand }: LinkButtonProps) {
|
|
return (
|
|
<a class="tn-link" href="#"
|
|
data-trigger-command={triggerCommand}
|
|
role="button"
|
|
onKeyDown={(e)=> {
|
|
if (e.code === "Space") {
|
|
onClick?.();
|
|
}
|
|
}}
|
|
onClick={(e) => {
|
|
e.preventDefault();
|
|
onClick?.();
|
|
}}>
|
|
{text}
|
|
</a>
|
|
)
|
|
} |