feat(react): port info modal

This commit is contained in:
Elian Doran
2025-08-03 23:20:32 +03:00
parent e53ad2c62a
commit a62f12b427
4 changed files with 72 additions and 84 deletions

View File

@@ -1,6 +1,9 @@
import { RefObject } from "preact";
import { useRef } from "preact/hooks";
interface ButtonProps {
/** Reference to the button element. Mostly useful for requesting focus. */
buttonRef: RefObject<HTMLButtonElement>;
text: string;
className?: string;
keyboardShortcut?: string;
@@ -8,14 +11,14 @@ interface ButtonProps {
onClick?: () => void;
}
export default function Button({ className, text, onClick, keyboardShortcut }: ButtonProps) {
export default function Button({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut }: ButtonProps) {
const classes: string[] = ["btn"];
classes.push("btn-primary");
if (className) {
classes.push(className);
}
const buttonRef = useRef<HTMLButtonElement>(null);
const buttonRef = _buttonRef ?? useRef<HTMLButtonElement>(null);
const splitShortcut = (keyboardShortcut ?? "").split("+");
return (