lbry-desktop/ui/modal/modalImageUpload/view.jsx

36 lines
933 B
React
Raw Permalink Normal View History

2020-06-29 21:54:07 +02:00
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
import SelectAsset from 'component/selectAsset';
type Props = {
closeModal: () => void,
currentValue: string,
title: string,
helpText: string,
onUpdate: (string, boolean, ?string) => void,
assetName: string,
2020-06-29 21:54:07 +02:00
};
function ModalImageUpload(props: Props) {
const { closeModal, currentValue, title, assetName, helpText, onUpdate } = props;
const filters = React.useMemo(() => [{ name: 'Images', extensions: ['jpg', 'jpeg', 'png', 'gif', 'svg'] }]);
2020-06-29 21:54:07 +02:00
return (
<Modal isOpen type="card" onAborted={closeModal} contentLabel={title}>
<SelectAsset
filters={filters}
type="openFile"
onUpdate={onUpdate}
currentValue={currentValue}
assetName={assetName}
recommended={helpText}
onDone={closeModal}
buildImagePreview
2020-06-29 21:54:07 +02:00
/>
</Modal>
);
}
2020-06-29 21:54:07 +02:00
export default ModalImageUpload;