-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[김진희] Sprint 11 #326
The head ref may contain hidden characters: "Next-\uAE40\uC9C4\uD76C"
[김진희] Sprint 11 #326
Changes from all commits
e8f517f
51eb29d
6c07f11
f556e72
eaefa83
2b6b3d1
ed74326
aae2f7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { ButtonHTMLAttributes, ReactNode } from 'react'; | ||
import styles from '@/styles/Common.module.css'; | ||
import classNames from 'classnames'; | ||
|
||
interface ButtonProp extends ButtonHTMLAttributes<HTMLButtonElement> { | ||
children: ReactNode; | ||
size: 'small' | 'medium' | 'large'; | ||
} | ||
|
||
function Button({ children, size = 'small', ...rest }: ButtonProp) { | ||
const buttonClass = classNames({ | ||
[styles.smallButton]: size === 'small', | ||
[styles.mediumButton]: size === 'medium', | ||
[styles.largeButton]: size === 'large', | ||
}); | ||
|
||
return ( | ||
<> | ||
<button className={buttonClass} {...rest}> | ||
<div>{children}</div> | ||
</button> | ||
</> | ||
); | ||
} | ||
|
||
export default Button; |
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
// import type { AppProps } from 'next/app' | ||
import { useRouter } from 'next/router'; | ||
import Header from '../components/Header'; | ||
import '@/styles/globals.css'; | ||
import '@/styles/Home.module.css' | ||
import '@/styles/JoinForm.module.css' | ||
import '@/styles/Header.module.css'; | ||
import '@/styles/Boards.module.css'; | ||
import '@/styles/BestBoard.module.css'; | ||
import '@/styles/EntireBoard.module.css'; | ||
|
||
export default function App({ Component, pageProps }) { | ||
const router = useRouter(); | ||
const noHeaderPages = ['/signup', '/login', '/']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 크으 레이아웃도 조건부로 잘 작성하셨네요 👍훌륭합니다. ㄷㄷㄷ👍👍 화이트리스트를 만들어서 특정 페이지는 노출되지 않게끔 잘 작성하셨네요 👍👍 |
||
|
||
return ( | ||
<> | ||
<Header /> | ||
{!noHeaderPages.includes(router.pathname) && <Header />} | ||
<Component {...pageProps} /> | ||
</> | ||
); | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,12 +3,12 @@ import Link from 'next/link'; | |||||
import Image from 'next/image'; | ||||||
import axios from '@/pages/api/api'; | ||||||
import SelectBox from '@/components/common/SelectBox'; | ||||||
import SmallButton from '@/components/common/SmallButton'; | ||||||
import Button from '@/components/common/Button'; | ||||||
import Comment from '@/components/Comment'; | ||||||
import Profile from '@/public/ic_profile.svg'; | ||||||
import Heart from '@/public/ic_heart.svg'; | ||||||
import EmptyComment from '@/public/img_empty_comment.svg'; | ||||||
import Back from '@/public/ic_back.svg'; | ||||||
import Profile from '@/public/icons/ic_profile.svg'; | ||||||
import Heart from '@/public/icons/ic_heart.svg'; | ||||||
import EmptyComment from '@/public/images/img_empty_comment.svg'; | ||||||
import Back from '@/public/icons/ic_back.svg'; | ||||||
import styles from '@/styles/DetailedBoard.module.css'; | ||||||
|
||||||
function formatDate(value) { | ||||||
|
@@ -40,7 +40,7 @@ export async function getServerSideProps(context) { | |||||
} | ||||||
} | ||||||
|
||||||
export default function Board({ articleData, initialCommentData }) { | ||||||
export default function Board({ articleData, commentData: initialCommentData }) { | ||||||
const [comment, setComment] = useState(''); | ||||||
const [isFormValid, setIsFormValid] = useState(false); | ||||||
const [commentData, setCommentData] = useState(initialCommentData || []); | ||||||
|
@@ -123,9 +123,9 @@ export default function Board({ articleData, initialCommentData }) { | |||||
/> | ||||||
</div> | ||||||
<div className={styles.commentButton}> | ||||||
<SmallButton type="submit" disabled={!isFormValid}> | ||||||
<Button type="submit" disabled={!isFormValid}> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
<Button type="submit" disabled={!isFormValid}> | |
<Button type="submit" disabled={!(comment.trim() !== '')}> |
isFormValid
가 있기에 리렌더링을 한번 더 하게 됩니다. 이런 경우 그냥 조건부에 추가만 해주시면 불필요한 리렌더링 없이 잘 노출될거예요 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와우 ㄷㄷㄷ 👍👍👍
질문에 답변하려고 왔는데 .. 공용 컴포넌트로 손색이 없는데요 ..?