-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Expand file tree
/
Copy pathInsertButton.tsx
More file actions
32 lines (30 loc) · 1 KB
/
InsertButton.tsx
File metadata and controls
32 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { ArrowLeftEndOnRectangleIcon } from "@heroicons/react/24/outline";
import { ToolTip } from "../../gui/Tooltip";
import HoverItem from "../../mainInput/InputToolbar/HoverItem";
/**
* Button that inserts code at the current cursor position
*/
interface InsertButtonProps {
onInsert: () => void;
}
export function InsertButton({ onInsert }: InsertButtonProps) {
return (
<HoverItem
data-tooltip-id="codeblock-insert-button-tooltip"
className="!p-0"
>
<ToolTip place="top" content="Insert Code">
<div
role="button"
aria-label="Insert at cursor"
className="text-lightgray flex cursor-pointer items-center border-none bg-transparent text-xs outline-none hover:brightness-125"
onClick={onInsert}
>
<div className="max-2xs:hidden flex items-center gap-1 transition-colors duration-200">
<ArrowLeftEndOnRectangleIcon className="h-3.5 w-3.5" />
</div>
</div>
</ToolTip>
</HoverItem>
);
}