mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: tweak resource definition
This commit is contained in:
@ -10,8 +10,8 @@ interface Props {
|
||||
const ResourceListView = (props: Props) => {
|
||||
const { resourceList, setResourceList } = props;
|
||||
|
||||
const handleDeleteResource = async (resourceId: ResourceId) => {
|
||||
setResourceList(resourceList.filter((resource) => resource.id !== resourceId));
|
||||
const handleDeleteResource = async (name: string) => {
|
||||
setResourceList(resourceList.filter((resource) => resource.name !== name));
|
||||
};
|
||||
|
||||
return (
|
||||
@ -21,14 +21,14 @@ const ResourceListView = (props: Props) => {
|
||||
{resourceList.map((resource) => {
|
||||
return (
|
||||
<div
|
||||
key={resource.id}
|
||||
key={resource.name}
|
||||
className="max-w-full flex flex-row justify-start items-center flex-nowrap gap-x-1 bg-zinc-100 dark:bg-zinc-900 px-2 py-1 rounded text-gray-500 dark:text-gray-400"
|
||||
>
|
||||
<ResourceIcon resource={resource} className="!w-4 !h-4 !opacity-100" />
|
||||
<span className="text-sm max-w-[8rem] truncate">{resource.filename}</span>
|
||||
<Icon.X
|
||||
className="w-4 h-auto cursor-pointer opacity-60 hover:opacity-100"
|
||||
onClick={() => handleDeleteResource(resource.id)}
|
||||
onClick={() => handleDeleteResource(resource.name)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user