feat(react/dialogs): port note revisions

This commit is contained in:
Elian Doran
2025-08-06 16:16:30 +03:00
parent f7e7b38551
commit 7ac0828ae7
6 changed files with 200 additions and 391 deletions

View File

@@ -1,4 +1,5 @@
import { RefObject } from "preact";
import { CSSProperties } from "preact/compat";
import { useRef } from "preact/hooks";
interface ButtonProps {
@@ -12,9 +13,11 @@ interface ButtonProps {
onClick?: () => void;
primary?: boolean;
disabled?: boolean;
small?: boolean;
style?: CSSProperties;
}
export default function Button({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled }: ButtonProps) {
export default function Button({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, small, style }: ButtonProps) {
const classes: string[] = ["btn"];
if (primary) {
classes.push("btn-primary");
@@ -24,6 +27,9 @@ export default function Button({ buttonRef: _buttonRef, className, text, onClick
if (className) {
classes.push(className);
}
if (small) {
classes.push("btn-sm");
}
const buttonRef = _buttonRef ?? useRef<HTMLButtonElement>(null);
const splitShortcut = (keyboardShortcut ?? "").split("+");
@@ -35,6 +41,7 @@ export default function Button({ buttonRef: _buttonRef, className, text, onClick
onClick={onClick}
ref={buttonRef}
disabled={disabled}
style={style}
>
{icon && <span className={`bx ${icon}`}></span>}
{text} {keyboardShortcut && (