2022-03-31 09:59:10 +00:00
|
|
|
import React, {useState} from 'react';
|
|
|
|
import MDContent from "./MDContent";
|
|
|
|
import {v4 as uuidv4} from 'uuid';
|
|
|
|
|
2022-04-05 04:47:41 +00:00
|
|
|
function MDContainer({post, fileNames}) {
|
2022-03-31 09:59:10 +00:00
|
|
|
const [posts, setPosts] = useState([post]);
|
|
|
|
|
|
|
|
function handleClick(content) {
|
2022-04-18 00:58:20 +00:00
|
|
|
// console.log(content)
|
2022-03-31 09:59:10 +00:00
|
|
|
setPosts(prevPosts => {
|
|
|
|
return [...prevPosts, content]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="Container">
|
|
|
|
{posts.map(p => (
|
2022-04-05 04:47:41 +00:00
|
|
|
<MDContent key={uuidv4()} content={p} handleOpenNewContent={handleClick} fileNames={fileNames}/>
|
2022-03-31 09:59:10 +00:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MDContainer;
|