mirror of
https://github.com/plankanban/planka.git
synced 2025-12-18 01:11:13 +03:00
24 lines
542 B
JavaScript
24 lines
542 B
JavaScript
import React, { useCallback } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { FilePicker } from '../../lib/custom-ui';
|
|
|
|
const AddAttachment = React.memo(({ children, onCreate }) => {
|
|
const handleFileSelect = useCallback(
|
|
(file) => {
|
|
onCreate({
|
|
file,
|
|
});
|
|
},
|
|
[onCreate],
|
|
);
|
|
|
|
return <FilePicker onSelect={handleFileSelect}>{children}</FilePicker>;
|
|
});
|
|
|
|
AddAttachment.propTypes = {
|
|
children: PropTypes.element.isRequired,
|
|
onCreate: PropTypes.func.isRequired,
|
|
};
|
|
|
|
export default AddAttachment;
|