-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : ag-grid 설치 , ListModal, PostModal 컴포넌트 마이그레이션
- Loading branch information
Showing
11 changed files
with
359 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
Mindspace_front_next/app/map/components/ListModal/ListModal.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
.header { | ||
&__button { | ||
border: none; | ||
background-color: transparent; | ||
margin-left: 0.1rem; | ||
cursor: pointer; | ||
} | ||
|
||
&__span { | ||
color: white; | ||
font-size: 2rem; | ||
} | ||
} | ||
|
||
.post { | ||
&__button { | ||
font-size: 1.5rem; | ||
color: white; | ||
} | ||
|
||
&__wrapper { | ||
display: flex; | ||
width: 100%; | ||
height: 90%; | ||
|
||
&__content { | ||
padding: 2.5rem 2rem 0 2rem; | ||
display: flex; | ||
flex: 2; | ||
background-color: white; | ||
border-radius: 10px; | ||
|
||
&__wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
|
||
&__header { | ||
display: flex; | ||
flex-direction: row; | ||
|
||
&__text { | ||
display: flex; | ||
flex-direction: column; | ||
margin: 1rem; | ||
|
||
&__title { | ||
font-size: 1.7rem; | ||
} | ||
} | ||
} | ||
|
||
&__info { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 0 0 0 auto; | ||
padding-right: 1rem; | ||
height: 1rem; | ||
width: 8rem; | ||
|
||
&__box { | ||
margin: 0 0 0.5rem 0; | ||
align-self: flex-end; | ||
|
||
&__button { | ||
padding: 5px 10px; | ||
font-size: 15px; | ||
border: none; | ||
border-radius: 4px; | ||
background-color: navy; | ||
color: white; | ||
cursor: pointer; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
transition: transform 0.2s ease; | ||
|
||
&:hover { | ||
transform: translateY(-2px); | ||
} | ||
|
||
&:active { | ||
transform: translateY(1px); | ||
} | ||
} | ||
} | ||
|
||
&__date { | ||
margin-right: 0; | ||
align-self: flex-end; | ||
} | ||
|
||
&__name { | ||
margin-right: 0; | ||
align-self: flex-end; | ||
} | ||
} | ||
|
||
&__content { | ||
&__span { | ||
font-size: 1rem; | ||
margin: 1rem; | ||
} | ||
} | ||
} | ||
} | ||
|
||
&__viewer { | ||
overflow-y: auto; | ||
position: relative; | ||
border-top: 1px #ebedf2 solid; | ||
padding: 5px 0 0 10px; | ||
background: white; | ||
margin: 0.5rem; | ||
} | ||
} | ||
} |
152 changes: 152 additions & 0 deletions
152
Mindspace_front_next/app/map/components/ListModal/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
import { useState, useEffect, useRef } from "react"; | ||
import PostTable from "../PostTable"; | ||
import styles from "./ListModal.module.scss"; | ||
import { ListModalProps } from "@/constants/types"; | ||
import { Viewer } from "@toast-ui/react-editor"; | ||
import CustomModal from "@/components/CustomModal"; | ||
import { usePostGetQuery } from "@/hooks/queries/board"; | ||
|
||
import { formatDateTime, DateTimeFormat } from "@/utils/dateTime"; | ||
// import CommentModal from "@/pages/NodeMap/components/CommentModal"; | ||
|
||
function ListModal({ listModalOpen, onListRequestClose }: ListModalProps) { | ||
const [isSelectedTable, setIsSelectedTable] = useState<number>(); | ||
const viewerRef = useRef<Viewer>(null); | ||
const { data: postData, isLoading } = usePostGetQuery(isSelectedTable); | ||
// const [commentModalOpen, setCommentModalOpen] = useState(false); | ||
// const commentData = [ | ||
// { | ||
// id: 1, | ||
// nickname: "작성자1", | ||
// content: "댓글 내용1", | ||
// date: "5분전", | ||
// }, | ||
// { | ||
// id: 2, | ||
// nickname: "작성자2", | ||
// content: "댓글 내용2", | ||
// date: "10분전", | ||
// }, | ||
// ]; | ||
// const toggleCommentModal = () => { | ||
// setCommentModalOpen((prev) => !prev); | ||
// }; | ||
|
||
const handleSelectBoard = (id: number) => { | ||
setIsSelectedTable(id); | ||
// setCommentModalOpen(false); | ||
}; | ||
|
||
useEffect(() => { | ||
if (viewerRef.current) { | ||
viewerRef.current.getInstance().setMarkdown(postData?.content); | ||
} | ||
}, [postData?.content]); | ||
|
||
return ( | ||
<CustomModal | ||
isOpen={listModalOpen} | ||
onRequestClose={onListRequestClose} | ||
resizable | ||
style={{ | ||
padding: "1rem", | ||
}} | ||
> | ||
{!isSelectedTable ? ( | ||
<> | ||
<button | ||
className={styles.header__button} | ||
onClick={onListRequestClose} | ||
> | ||
<span className={styles.header__span}>x</span> | ||
</button> | ||
<PostTable onClickedId={handleSelectBoard} /> | ||
</> | ||
) : ( | ||
!isLoading && ( | ||
<> | ||
<button | ||
className={styles.header__button} | ||
onClick={() => { | ||
setIsSelectedTable(undefined); | ||
}} | ||
> | ||
<span className={styles.post__button}>Back</span> | ||
</button> | ||
<div className={styles.post__wrapper}> | ||
<div className={styles.post__wrapper__content}> | ||
<div className={styles.post__wrapper__content__wrapper}> | ||
<div | ||
className={styles.post__wrapper__content__wrapper__header} | ||
> | ||
<div | ||
className={ | ||
styles.post__wrapper__content__wrapper__header__text | ||
} | ||
> | ||
<span | ||
className={ | ||
styles.post__wrapper__content__wrapper__header__text__title | ||
} | ||
> | ||
{postData?.title} | ||
</span> | ||
</div> | ||
<div | ||
className={styles.post__wrapper__content__wrapper__info} | ||
> | ||
<div | ||
className={ | ||
styles.post__wrapper__content__wrapper__info__box | ||
} | ||
> | ||
<button | ||
// onClick={toggleCommentModal} | ||
className={ | ||
styles.post__wrapper__content__wrapper__info__box__button | ||
} | ||
> | ||
댓글 | ||
</button> | ||
</div> | ||
<span | ||
className={ | ||
styles.post__wrapper__content__wrapper__info__name | ||
} | ||
> | ||
{postData.userNickname} | ||
</span> | ||
<span | ||
className={ | ||
styles.post__wrapper__content__wrapper__info__date | ||
} | ||
> | ||
{formatDateTime( | ||
postData.updatedAt, | ||
DateTimeFormat.Date, | ||
)} | ||
</span> | ||
</div> | ||
</div> | ||
<div className={styles.post__wrapper__viewer}> | ||
<Viewer | ||
ref={viewerRef} | ||
initialValue={postData?.content} | ||
usageStatistics={false} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
{/* <CommentModal | ||
isOpen={commentModalOpen} | ||
initialValue={commentData} | ||
/> */} | ||
</div> | ||
</> | ||
) | ||
)} | ||
</CustomModal> | ||
); | ||
} | ||
|
||
export default ListModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.