chore: update MemoResources props (#432)

This commit is contained in:
Zeng1998 2022-11-09 22:10:31 +08:00 committed by GitHub
parent dc5d705f8c
commit 1e3b8315a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 11 deletions

View File

@ -67,7 +67,7 @@ const ArchivedMemo: React.FC<Props> = (props: Props) => {
</div>
</div>
<MemoContent content={memo.content} />
<MemoResources memo={memo} />
<MemoResources resourceList={memo.resourceList} />
</div>
);
};

View File

@ -21,7 +21,7 @@ const DailyMemo: React.FC<Props> = (props: Props) => {
</div>
<div className="memo-container">
<MemoContent content={memo.content} displayConfig={displayConfig} />
<MemoResources memo={memo} />
<MemoResources resourceList={memo.resourceList} />
</div>
<div className="split-line"></div>
</div>

View File

@ -243,7 +243,7 @@ const Memo: React.FC<Props> = (props: Props) => {
onMemoContentClick={handleMemoContentClick}
onMemoContentDoubleClick={handleMemoContentDoubleClick}
/>
<MemoResources memo={memo} />
<MemoResources resourceList={memo.resourceList} />
</div>
);
};

View File

@ -195,7 +195,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
</div>
<div className="memo-container">
<MemoContent displayConfig={{ enableExpand: false }} content={memo.content} onMemoContentClick={handleMemoContentClick} />
<MemoResources memo={memo} />
<MemoResources resourceList={memo.resourceList} />
</div>
<div className="layer-container"></div>
{linkMemos.map((_, idx) => {

View File

@ -3,13 +3,14 @@ import Icon from "./Icon";
import "../less/memo-resources.less";
interface Props {
memo: Memo;
className?: string;
resourceList: Resource[];
}
const MemoResources: React.FC<Props> = (props: Props) => {
const { memo } = props;
const imageList = memo.resourceList.filter((resource) => resource.type.includes("image"));
const otherResourceList = memo.resourceList.filter((resource) => !resource.type.includes("image"));
const { className, resourceList } = props;
const imageList = resourceList.filter((resource) => resource.type.includes("image"));
const otherResourceList = resourceList.filter((resource) => !resource.type.includes("image"));
const handlPreviewBtnClick = (resource: Resource) => {
const resourceUrl = `${window.location.origin}/o/r/${resource.id}/${resource.filename}`;
@ -21,7 +22,7 @@ const MemoResources: React.FC<Props> = (props: Props) => {
});
return (
<div className="resource-wrapper">
<div className={`resource-wrapper ${className || ""}`}>
{imageList.length > 0 && (
<div className="images-wrapper">
{imageList.map((resource, index) => (

View File

@ -88,7 +88,7 @@ const Explore = () => {
</a>
</div>
<MemoContent className="memo-content" content={memo.content} onMemoContentClick={() => undefined} />
<MemoResources memo={memo} />
<MemoResources resourceList={memo.resourceList} />
</div>
);
})}

View File

@ -148,7 +148,7 @@ const MemoDetail = () => {
/>
</div>
<MemoContent className="memo-content" content={state.memo.content} onMemoContentClick={() => undefined} />
<MemoResources memo={state.memo} />
<MemoResources resourceList={state.memo.resourceList} />
</div>
</main>
)}