mirror of
https://github.com/usememos/memos.git
synced 2025-04-17 10:57:24 +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>
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
import dayjs from "dayjs";
|
|
import { useState } from "react";
|
|
import Icon from "./Icon";
|
|
import ResourceCover from "./ResourceCover";
|
|
import "../less/resource-card.less";
|
|
import ResourceItemDropdown from "./ResourceItemDropdown";
|
|
|
|
const ResourceCard = ({
|
|
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 className="resource-card">
|
|
<div className="w-full p-2 flex flex-row justify-between items-center absolute top-0 left-0">
|
|
<div onClick={() => handleSelectBtnClick()}>
|
|
{isSelected ? <Icon.CheckCircle2 className="resource-checkbox !flex" /> : <Icon.Circle className="resource-checkbox" />}
|
|
</div>
|
|
<div className="more-action-btn">
|
|
<ResourceItemDropdown
|
|
resource={resource}
|
|
handleCopyResourceLinkBtnClick={handleCopyResourceLinkBtnClick}
|
|
handleDeleteResourceBtnClick={handleDeleteResourceBtnClick}
|
|
handlePreviewBtnClick={handlePreviewBtnClick}
|
|
handleRenameBtnClick={handleRenameBtnClick}
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="w-full flex flex-row justify-center items-center pb-2 pt-4 px-2">
|
|
<ResourceCover resource={resource} />
|
|
</div>
|
|
<div className="w-full flex flex-col justify-start items-center px-1 select-none">
|
|
<div className="w-full text-base text-center text-ellipsis overflow-hidden">{resource.filename}</div>
|
|
<div className="text-xs text-gray-400 text-center">{dayjs(resource.createdTs).locale("en").format("YYYY/MM/DD HH:mm:ss")}</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ResourceCard;
|