feat: memo editor dialog (#1772)

* feat: memo editor dialog

* chore: update mark

* chore: update
This commit is contained in:
boojack
2023-05-30 20:23:26 +08:00
committed by GitHub
parent 25ce36e495
commit dd8c10743d
14 changed files with 215 additions and 404 deletions

View File

@ -1,20 +1,23 @@
import { useEditorStore } from "@/store/module";
import Icon from "../Icon";
import ResourceIcon from "../ResourceIcon";
const ResourceListView = () => {
const editorStore = useEditorStore();
const editorState = editorStore.state;
interface Props {
resourceList: Resource[];
setResourceList: (resourceList: Resource[]) => void;
}
const ResourceListView = (props: Props) => {
const { resourceList, setResourceList } = props;
const handleDeleteResource = async (resourceId: ResourceId) => {
editorStore.setResourceList(editorState.resourceList.filter((resource) => resource.id !== resourceId));
setResourceList(resourceList.filter((resource) => resource.id !== resourceId));
};
return (
<>
{editorState.resourceList && editorState.resourceList.length > 0 && (
{resourceList.length > 0 && (
<div className="w-full flex flex-row justify-start flex-wrap gap-2 mt-2">
{editorState.resourceList.map((resource) => {
{resourceList.map((resource) => {
return (
<div
key={resource.id}