mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 08:15:52 +01:00
feat(react/dialogs): port upload attachments
This commit is contained in:
@@ -11,9 +11,10 @@ interface ButtonProps {
|
||||
/** Called when the button is clicked. If not set, the button will submit the form (if any). */
|
||||
onClick?: () => void;
|
||||
primary?: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export default function Button({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary }: ButtonProps) {
|
||||
export default function Button({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled }: ButtonProps) {
|
||||
const classes: string[] = ["btn"];
|
||||
if (primary) {
|
||||
classes.push("btn-primary");
|
||||
@@ -33,6 +34,7 @@ export default function Button({ buttonRef: _buttonRef, className, text, onClick
|
||||
type={onClick ? "button" : "submit"}
|
||||
onClick={onClick}
|
||||
ref={buttonRef}
|
||||
disabled={disabled}
|
||||
>
|
||||
{icon && <span className={`bx ${icon}`}></span>}
|
||||
{text} {keyboardShortcut && (
|
||||
|
||||
13
apps/client/src/widgets/react/FormFileUpload.tsx
Normal file
13
apps/client/src/widgets/react/FormFileUpload.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
interface FormFileUploadProps {
|
||||
onChange: (files: FileList | null) => void;
|
||||
multiple?: boolean;
|
||||
}
|
||||
|
||||
export default function FormFileUpload({ onChange, multiple }: FormFileUploadProps) {
|
||||
return (
|
||||
<label class="tn-file-input tn-input-field">
|
||||
<input type="file" class="form-control-file" multiple={multiple}
|
||||
onChange={e => onChange((e.target as HTMLInputElement).files)} />
|
||||
</label>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user