mirror of
https://github.com/plankanban/planka.git
synced 2025-08-01 03:25:26 +02:00
Add file attachments
This commit is contained in:
parent
87a3cf751a
commit
f743f4ea8b
103 changed files with 1847 additions and 305 deletions
45
client/src/components/CardModal/Attachments/Attachments.jsx
Normal file
45
client/src/components/CardModal/Attachments/Attachments.jsx
Normal file
|
@ -0,0 +1,45 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import Item from './Item';
|
||||
|
||||
const Attachments = React.memo(({ items, onUpdate, onDelete }) => {
|
||||
const handleUpdate = useCallback(
|
||||
(id, data) => {
|
||||
onUpdate(id, data);
|
||||
},
|
||||
[onUpdate],
|
||||
);
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(id) => {
|
||||
onDelete(id);
|
||||
},
|
||||
[onDelete],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{items.map((item) => (
|
||||
<Item
|
||||
key={item.id}
|
||||
name={item.name}
|
||||
url={item.url}
|
||||
thumbnailUrl={item.thumbnailUrl}
|
||||
createdAt={item.createdAt}
|
||||
isPersisted={item.isPersisted}
|
||||
onUpdate={(data) => handleUpdate(item.id, data)}
|
||||
onDelete={() => handleDelete(item.id)}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
Attachments.propTypes = {
|
||||
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||
onUpdate: PropTypes.func.isRequired,
|
||||
onDelete: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default Attachments;
|
Loading…
Add table
Add a link
Reference in a new issue