mirror of
https://github.com/usememos/memos.git
synced 2025-04-17 19:07:26 +02:00
* stash: file upload * feat: add style button * feat: add style of list * feat: add checkbox for list * feat: support file upload by drag * feat: beautify the ui * feat: support file upload * stash * fix: the resource is incorrectly when upload multiple files * feat: beautify the ui * chore: reduce unused line * stash * chore: deleted unused line * chore: deleted unused line * chore * chore: change the function declare * feat: support to prompt file is too large * feat:drop prompt to cover all element * fix: eslint * fix: the name of i18n * chore: refactor the import deps * feat: beautify the ui * feat: support the style of button * feat: beautify the switch ui * chore: refactor the component * chore: refactor the resource item dropdown * feat: use memo to reduce unused computing in drop * feat: use memo to reduce the calc of resource list * chore:change name * Update web/src/locales/en.json Co-authored-by: boojack <stevenlgtm@gmail.com> * chore: the import of deps * fix: the window size of fecting data * feat: support to save the state of style * remove pnpm-lock * merge main * chore: simpify the statement * fix: delete conflict marker * feat: add i18n for select * feat:support dark mode * eslint * feat: delete the storage of resource style --------- Co-authored-by: boojack <stevenlgtm@gmail.com>
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { useState } from "react";
|
|
import ResourceItemDropdown from "./ResourceItemDropdown";
|
|
|
|
const ResourceItem = ({
|
|
resource,
|
|
handleCheckClick,
|
|
handleUncheckClick,
|
|
handlePreviewBtnClick,
|
|
handleCopyResourceLinkBtnClick,
|
|
handleRenameBtnClick,
|
|
handleDeleteResourceBtnClick,
|
|
}: ResourceItemType) => {
|
|
const [isSelected, setIsSelected] = useState<boolean>(false);
|
|
|
|
const handleSelectBtnClick = () => {
|
|
if (isSelected) {
|
|
handleUncheckClick();
|
|
} else {
|
|
handleCheckClick();
|
|
}
|
|
setIsSelected(!isSelected);
|
|
};
|
|
|
|
return (
|
|
<div key={resource.id} className="px-2 py-2 w-full grid grid-cols-7">
|
|
<span className="w-full m-auto truncate col-span-1 justify-center">
|
|
<input type="checkbox" onClick={handleSelectBtnClick}></input>
|
|
</span>
|
|
<span className="w-full m-auto truncate text-base pr-2 last:pr-0 col-span-1">{resource.id}</span>
|
|
<span className="w-full m-auto truncate text-base pr-2 last:pr-0 col-span-4" onClick={() => handleRenameBtnClick(resource)}>
|
|
{resource.filename}
|
|
</span>
|
|
<div className="w-full flex flex-row justify-between items-center mb-2">
|
|
<ResourceItemDropdown
|
|
resource={resource}
|
|
handleCopyResourceLinkBtnClick={handleCopyResourceLinkBtnClick}
|
|
handleDeleteResourceBtnClick={handleDeleteResourceBtnClick}
|
|
handlePreviewBtnClick={handlePreviewBtnClick}
|
|
handleRenameBtnClick={handleRenameBtnClick}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ResourceItem;
|