fix: 자유게시판 줄바꿈 처리

This commit is contained in:
jhynsoo 2024-08-13 09:37:32 +09:00
parent 0c000cd1b8
commit d2bde2c4ea
2 changed files with 12 additions and 41 deletions

View File

@ -1,11 +1,10 @@
import BackIcon from '/src/assets/icons/back.svg?react';
import { Link } from 'react-router-dom';
import styles from './FreeboardDetail.module.css'; import styles from './FreeboardDetail.module.css';
import FreeboardCommentInput from './FreeDetailComments/FreeboardCommentInput'; import FreeboardCommentInput from './FreeDetailComments/FreeboardCommentInput';
import FreeboardComment from './FreeDetailComments/FreeboardComment'; import FreeboardComment from './FreeDetailComments/FreeboardComment';
import { useComments } from '../../../hooks/api/useComments'; import { useComments } from '../../../hooks/api/useComments';
import { useCommentWrite } from '../../../hooks/api/useCommentWrite'; import { useCommentWrite } from '../../../hooks/api/useCommentWrite';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import ArticleDetail from '../ArticleDetail/ArticleDetail';
export default function FreeboardDetail({ topic, title, author, content, onDelete, isMine }) { export default function FreeboardDetail({ topic, title, author, content, onDelete, isMine }) {
const { freeboardId } = useParams(); const { freeboardId } = useParams();
@ -20,43 +19,15 @@ export default function FreeboardDetail({ topic, title, author, content, onDelet
return ( return (
<div className={styles.freeboardDetail}> <div className={styles.freeboardDetail}>
<header className={styles.header}> <ArticleDetail
<div className={styles.headerInside}> topic={topic}
<Link title={title}
to={'..'} author={author}
className={styles.goBack} content={content}
> onDelete={onDelete}
<BackIcon /> isQna={false}
<span>{topic}</span> isMine={isMine}
</Link> />
<div>
<h1 className={styles.title}>{title}</h1>
{author && <span className={styles.author}>{author}</span>}
</div>
</div>
{isMine && (
<div className={styles.actionGroup}>
<Link
to="edit"
className={styles.edit}
state={{ title: title, content: content }}
>
수정
</Link>
<button
type="button"
className={styles.delete}
onClick={onDelete}
>
<div>삭제</div>
</button>
</div>
)}
</header>
<div>
<p className={styles.content}>{content}</p>
</div>
{comments && ( {comments && (
<div className={styles.commentWrapper}> <div className={styles.commentWrapper}>
{comments.map((comment) => ( {comments.map((comment) => (

View File

@ -9,7 +9,7 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
/*
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -113,7 +113,7 @@
.delete { .delete {
color: var(--error-color); color: var(--error-color);
} } */
.commentWrapper { .commentWrapper {
display: flex; display: flex;