mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
type button for comment attach buttons
This commit is contained in:
parent
2f8b5599b2
commit
373dc04a6b
1 changed files with 12 additions and 6 deletions
|
@ -10,26 +10,32 @@ interface IProps {
|
||||||
|
|
||||||
const CommentFormAttachButtons: FC<IProps> = ({ onUpload }) => {
|
const CommentFormAttachButtons: FC<IProps> = ({ onUpload }) => {
|
||||||
const onInputChange = useCallback(
|
const onInputChange = useCallback(
|
||||||
event => {
|
(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const files = Array.from(event.target?.files as File[]).filter((file: File) =>
|
const files = Array.from(event.target?.files as File[]).filter(
|
||||||
COMMENT_FILE_TYPES.includes(file.type)
|
(file: File) => COMMENT_FILE_TYPES.includes(file.type),
|
||||||
);
|
);
|
||||||
if (!files || !files.length) return;
|
if (!files || !files.length) return;
|
||||||
|
|
||||||
onUpload(files);
|
onUpload(files);
|
||||||
},
|
},
|
||||||
[onUpload]
|
[onUpload],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button iconLeft="photo" size="small" color="gray" iconOnly>
|
<Button iconLeft="photo" size="small" color="gray" iconOnly type="button">
|
||||||
<input type="file" onInput={onInputChange} multiple accept="image/*" />
|
<input type="file" onInput={onInputChange} multiple accept="image/*" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button iconRight="audio" size="small" color="gray" iconOnly>
|
<Button
|
||||||
|
iconRight="audio"
|
||||||
|
size="small"
|
||||||
|
color="gray"
|
||||||
|
iconOnly
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
<input type="file" onInput={onInputChange} multiple accept="audio/*" />
|
<input type="file" onInput={onInputChange} multiple accept="audio/*" />
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue