mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 00:05:50 +01:00
feat(react/dialogs): port incorrect_cpu_arch
This commit is contained in:
@@ -6,12 +6,13 @@ interface ButtonProps {
|
||||
buttonRef?: RefObject<HTMLButtonElement>;
|
||||
text: string;
|
||||
className?: string;
|
||||
icon?: string;
|
||||
keyboardShortcut?: string;
|
||||
/** Called when the button is clicked. If not set, the button will submit the form (if any). */
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export default function Button({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut }: ButtonProps) {
|
||||
export default function Button({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon }: ButtonProps) {
|
||||
const classes: string[] = ["btn"];
|
||||
classes.push("btn-primary");
|
||||
if (className) {
|
||||
@@ -28,6 +29,7 @@ export default function Button({ buttonRef: _buttonRef, className, text, onClick
|
||||
onClick={onClick}
|
||||
ref={buttonRef}
|
||||
>
|
||||
{icon && <span className={`bx ${icon}`}></span>}
|
||||
{text} {keyboardShortcut && (
|
||||
splitShortcut.map((key, index) => (
|
||||
<>
|
||||
|
||||
@@ -9,6 +9,7 @@ interface ModalProps {
|
||||
size: "lg" | "md" | "sm";
|
||||
children: ComponentChildren;
|
||||
footer?: ComponentChildren;
|
||||
footerAlignment?: "right" | "between";
|
||||
maxWidth?: number;
|
||||
zIndex?: number;
|
||||
/**
|
||||
@@ -30,7 +31,7 @@ interface ModalProps {
|
||||
helpPageId?: string;
|
||||
}
|
||||
|
||||
export default function Modal({ children, className, size, title, footer, onShown, onSubmit, helpPageId, maxWidth, zIndex, scrollable, onHidden: onHidden }: ModalProps) {
|
||||
export default function Modal({ children, className, size, title, footer, footerAlignment, onShown, onSubmit, helpPageId, maxWidth, zIndex, scrollable, onHidden: onHidden }: ModalProps) {
|
||||
const modalRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
if (onShown || onHidden) {
|
||||
@@ -100,7 +101,12 @@ export default function Modal({ children, className, size, title, footer, onShow
|
||||
);
|
||||
}
|
||||
|
||||
function ModalInner({ children, footer }: Pick<ModalProps, "children" | "footer">) {
|
||||
function ModalInner({ children, footer, footerAlignment }: Pick<ModalProps, "children" | "footer" | "footerAlignment">) {
|
||||
const footerStyle: CSSProperties = {};
|
||||
if (footerAlignment === "between") {
|
||||
footerStyle.justifyContent = "space-between";
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="modal-body">
|
||||
@@ -108,7 +114,7 @@ function ModalInner({ children, footer }: Pick<ModalProps, "children" | "footer"
|
||||
</div>
|
||||
|
||||
{footer && (
|
||||
<div className="modal-footer">
|
||||
<div className="modal-footer" style={footerStyle}>
|
||||
{footer}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user