-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #293 from wonsik3686/Next-정원식-Sprint10
[정원식] Sprint 10
- Loading branch information
Showing
63 changed files
with
1,235 additions
and
184 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
import Header from '@/src/components/layout/Header/Header'; | ||
import 'normalize.css'; | ||
import '@styles/reset.css'; | ||
|
||
import Header from '@components/layout/Header/Header'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; | ||
import type { AppProps } from 'next/app'; | ||
import Head from 'next/head'; | ||
import { useState } from 'react'; | ||
import 'normalize.css'; | ||
|
||
export default function App({ Component, pageProps }: AppProps) { | ||
const [queryClient] = useState(() => new QueryClient()); | ||
|
||
return ( | ||
<> | ||
<QueryClientProvider client={queryClient}> | ||
<Head> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/reset.min.css" | ||
/> | ||
</Head> | ||
<Header /> | ||
<Component {...pageProps} /> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
|
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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import { Html, Head, Main, NextScript } from 'next/document' | ||
import { Html, Head, Main, NextScript } from 'next/document'; | ||
|
||
export default function Document() { | ||
return ( | ||
<Html lang="en"> | ||
<Head /> | ||
<Head> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/reset.min.css" | ||
/> | ||
</Head> | ||
<body> | ||
<Main /> | ||
<NextScript /> | ||
</body> | ||
</Html> | ||
) | ||
); | ||
} |
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,16 @@ | ||
import AddBoardForm from '@components/board/AddBoardForm/AddBoardForm'; | ||
import BasicLayout from '@components/layout/BasicLayout/BasicLayout'; | ||
|
||
type AddBoardPageProps = {}; | ||
|
||
const AddBoardPage = ({}: AddBoardPageProps) => { | ||
return ( | ||
<> | ||
<BasicLayout> | ||
<AddBoardForm /> | ||
</BasicLayout> | ||
</> | ||
); | ||
}; | ||
|
||
export default AddBoardPage; |
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,47 @@ | ||
import ArticleCommentForm from '@components/board/ArticleCommentForm/ArticleCommentForm'; | ||
import ArticleSection from '@components/board/ArticleSection/ArticleSection'; | ||
import BasicLayout from '@components/layout/BasicLayout/BasicLayout'; | ||
import { getArticle } from '@lib/api/articleApi'; | ||
import { Article, ArticleDetailResponse } from '@type/ArticleTypes'; | ||
import { GetServerSideProps } from 'next'; | ||
|
||
export const getServerSideProps: GetServerSideProps = async (context) => { | ||
const { id } = context.query; | ||
getArticle({ articleId: Number(id) }) | ||
.then((res) => { | ||
return { | ||
props: { | ||
initArticle: res?.data, | ||
}, | ||
}; | ||
}) | ||
.catch((error) => { | ||
return { | ||
props: { | ||
initArticle: {}, | ||
}, | ||
}; | ||
}); | ||
return { | ||
props: { | ||
initArticle: {}, | ||
}, | ||
}; | ||
}; | ||
|
||
type BoardDetailPageProps = { | ||
initArticle: ArticleDetailResponse; | ||
}; | ||
|
||
const BoardDetailPage = ({ initArticle }: BoardDetailPageProps) => { | ||
return ( | ||
<> | ||
<BasicLayout> | ||
<ArticleSection article={initArticle} /> | ||
<ArticleCommentForm articleId={initArticle.id} /> | ||
</BasicLayout> | ||
</> | ||
); | ||
}; | ||
|
||
export default BoardDetailPage; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
src/components/board/AddBoardForm/AddBoardForm.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,22 @@ | ||
@import '/src/styles/global.scss'; | ||
|
||
.form { | ||
width: 100%; | ||
|
||
&__header { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin: 0 0 2rem; | ||
} | ||
|
||
&__input { | ||
display: flex; | ||
width: 100%; | ||
flex-direction: column; | ||
margin: 0 0 1.5rem; | ||
gap: 0.5rem; | ||
} | ||
} |
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,79 @@ | ||
import styles from './AddBoardForm.module.scss'; | ||
|
||
import SectionTitle from '@core/ui/SectionTitle/SectionTitle'; | ||
import UIButton from '@core/ui/buttons/UIButton/UIButton'; | ||
import UIInputLabel from '@core/ui/inputs/UIInputLabel/UIInputLabel'; | ||
import UIInput from '@core/ui/inputs/UIInput/UIInput'; | ||
import UITextarea from '@core/ui/inputs/UITextarea/UITextarea'; | ||
import UIImageInput from '@core/ui/inputs/UIImageInput/UIImageInput'; | ||
import useArticleForm from '@lib/hooks/useArticleForm'; | ||
|
||
const AddBoardForm = () => { | ||
const { | ||
setTitle, | ||
setContent, | ||
submitArticle, | ||
imageFile, | ||
initialPreview, | ||
handleImageChange, | ||
} = useArticleForm(); | ||
|
||
const handleChangeTitleInput = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setTitle(e.target.value); | ||
}; | ||
|
||
const handleChangeContentInput = ( | ||
e: React.ChangeEvent<HTMLTextAreaElement> | ||
) => { | ||
setContent(e.target.value); | ||
}; | ||
|
||
const handleKeyDown = (e: React.KeyboardEvent<HTMLElement>) => { | ||
if (e.key === 'Enter') e.preventDefault(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<form className={styles['form']}> | ||
<div className={styles['form__header']}> | ||
<SectionTitle title="게시글 쓰기" /> | ||
<UIButton | ||
children={'등록'} | ||
handleClick={submitArticle} | ||
type="box" | ||
buttonTagType="button" | ||
isDisabled={false} | ||
isSmallButton={false} | ||
/> | ||
</div> | ||
<div className={styles['form__input']}> | ||
<UIInputLabel text="*제목" /> | ||
<UIInput | ||
placeholder="제목을 입력해주세요" | ||
onKeyDown={handleKeyDown} | ||
onChange={handleChangeTitleInput} | ||
/> | ||
</div> | ||
<div className={styles['form__input']}> | ||
<UIInputLabel text="*내용" /> | ||
<UITextarea | ||
placeholder="내용을 입력해주세요" | ||
onTextareaKeyDown={handleKeyDown} | ||
onTextareaChange={handleChangeContentInput} | ||
/> | ||
</div> | ||
<div className={styles['form__input']}> | ||
<UIInputLabel text="*이미지" /> | ||
<UIImageInput | ||
onChangeFile={handleImageChange} | ||
initialPreview={initialPreview} | ||
file={imageFile} | ||
name="imgFile" | ||
/> | ||
</div> | ||
</form> | ||
</> | ||
); | ||
}; | ||
|
||
export default AddBoardForm; |
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
50 changes: 50 additions & 0 deletions
50
src/components/board/ArticleCommentCard/ArticleCommentCard.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,50 @@ | ||
@import '/src/styles/global.scss'; | ||
|
||
.card { | ||
display: flex; | ||
width: 100%; | ||
padding: 0.5rem 0.5rem 0.75rem; | ||
align-items: flex-start; | ||
flex-wrap: wrap; | ||
border-bottom: 1px solid $gray-200; | ||
background-color: $gray-10; | ||
|
||
&__contentWrapper { | ||
} | ||
|
||
&__content { | ||
@include Body4; | ||
color: $gray-800; | ||
word-break: keep-all; | ||
} | ||
|
||
&__metaWrapper { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-start; | ||
} | ||
|
||
&__profileImageWrapper { | ||
width: 2rem; | ||
height: 2rem; | ||
} | ||
|
||
&__profileImage { | ||
background-color: $gray-200; | ||
} | ||
|
||
&__writerWrapper { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
&__nickname { | ||
@include Caption1; | ||
color: $gray-600; | ||
} | ||
|
||
&__date { | ||
@include Caption1; | ||
color: $gray-400; | ||
} | ||
} |
Oops, something went wrong.