2023-12-24 06:11:22 +00:00
|
|
|
import React, { useState } from 'react';
|
2022-03-31 09:59:10 +00:00
|
|
|
import MDContent from "./MDContent";
|
2023-12-24 06:11:22 +00:00
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
2022-03-31 09:59:10 +00:00
|
|
|
|
2023-12-24 06:11:22 +00:00
|
|
|
function MDContainer({ post, fileNames }) {
|
|
|
|
const [posts, setPosts] = useState([post]);
|
2022-03-31 09:59:10 +00:00
|
|
|
|
2023-12-24 06:11:22 +00:00
|
|
|
function handleClick(content) {
|
|
|
|
setPosts(prevPosts => {
|
|
|
|
return [...prevPosts, content]
|
|
|
|
})
|
|
|
|
}
|
2022-03-31 09:59:10 +00:00
|
|
|
|
2023-12-24 06:11:22 +00:00
|
|
|
return (
|
2024-01-07 03:04:57 +00:00
|
|
|
<div className="">
|
2023-12-24 06:11:22 +00:00
|
|
|
{posts.map(p => (
|
|
|
|
<MDContent key={uuidv4()} content={p} handleOpenNewContent={handleClick} fileNames={fileNames} />
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
2022-03-31 09:59:10 +00:00
|
|
|
}
|
|
|
|
|
2023-12-24 06:11:22 +00:00
|
|
|
export default MDContainer;
|