-
Notifications
You must be signed in to change notification settings - Fork 1
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
Improve performace/#188 #167
Conversation
โฆresult category details
โฆbetter responsiveness
โฆserInfoCard for improved performance
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.
๊ณ ์ํ์
จ์ต๋๋ค
Suspense ๋ฐ์ด๋๋ฆฌ ๋ด์ ์ปดํฌ๋ํธ๊ฐ ์๋ฒ ์ธก์์ ์์ ํ ์ฒ๋ฆฌ๋์ง ์๋ ์ด์ ๊ฐ ๋ฐ๋ก ์๋์ฉ?? ResultCategory๋ Responsive ์ปดํฌ๋ํธ๋ก ๊ฐ์ธ์ ธ์์ง ์์ ๊ฒ ๊ฐ์์์!
@@ -10,7 +10,9 @@ function SubPageLayout({ children }: LayoutProps) { | |||
return ( | |||
<> | |||
<NavigationBar /> | |||
<Image src={background} width={800} height={288} className="w-full bg-white h-[18rem]" alt="background" /> | |||
<div className="relative bg-primary h-[18rem]"> | |||
<Image src={background} sizes="100vw" className="absolute bottom-0 bg-white" alt="background" /> |
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.
์ ๋ sizes๋ฅผ ๋ธ๋ผ์ฐ์ ๊ฐ ์ด๋ค ํฌ๊ธฐ ์ด๋ฏธ์ง๋ฅผ ๋ ๋๋งํ ์ง ์๋ ค์ฃผ๋ ์์ฑ
์ผ๋ก ์๊ณ ์๋๋ฐ background ์ด๋ฏธ์ง๋ ๋จ์ผ ์ด๋ฏธ์ง์ด๋ฏ๋ก sizes ์์ฑ์ด ํ์ ์์ง ์๋์ ??
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.
- ๊ธฐ๋ณธ img ํ๊ทธ์ sizes ์์ฑ์ ๋ง์ํ์ ์ ์๊ฐ ๋ง์ต๋๋ค. Next.js์ Image ํ๊ทธ์์ sizes ์์ฑ์ ์ ์ํ๋ฉด, srcset ์์ฑ์ด ์๋์ผ๋ก ์ต์ ํ๋์ด ๋ฐ์ํ ์ด๋ฏธ์ง๋ฅผ ๊ตฌํํ ์ ์์ต๋๋ค.
- ์๋ฅผ ๋ค์ด, sizes ์์ฑ์ด 100vw๋ก ๋์ผํ๋๋ผ๋ ๋ทฐํฌํธ๊ฐ 1000px์ด๋ฉด 1000w ์ด๋ฏธ์ง๋ฅผ, 2000px์ด๋ฉด 2000w ์ด๋ฏธ์ง๋ฅผ ๋ฐ์ ์ต์ ํํ ์ ์์ต๋๋ค!
(์ฐธ๊ณ )
@@ -1,4 +1,6 @@ | |||
/** @type {import('next').NextConfig} */ | |||
import withBundleAnalyzer from '@next/bundle-analyzer'; |
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.
๋ฒ๋ค ๋ถ์ํด์ฃผ๋ ๋๊ตฌ์ธ๊ฐ์ฉ? ์ด๋ฅผ ํตํด์ ๊ฐ์ ํด์ผ ํ ์ ์ ์ ์ ์๋๊ฑด๊ฐ์ !?
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.
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.
์๊ณ ๋ง์ผ์ จ์ต๋๋ค !
@@ -45,7 +45,7 @@ export const useFetchCredits = () => { | |||
|
|||
const fetchCredits = async () => { | |||
try { | |||
const { data } = await axios<CreditResponse[]>(`${API_PATH.graduations}/credits`, { | |||
const { data } = await fetchAX.get<CreditResponse[]>(`${API_PATH.graduations}/credits`, { |
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.
fetchAX.create๋ฅผ ํตํด ์์ฑํ instance๋ฅผ ์ฌ์ฉํ์ง์๊ณ fetchAX๋ฅผ ํตํด ์์ฒญ์ ํธ์ถํ ์ด์ ๊ฐ ์๋์?
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.
- ์ฒ์์๋ ์์ฑํ instance๋ฅผ ์ฌ์ฉํ๋ ค ํ์ผ๋, ํด๋ผ์ด์ธํธ์์ next/headers ์ ๊ทผ์ด ๋ถ๊ฐ๋ฅํ๋ค๋ ์๋ฌ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๋ฐ๋ผ์ ํด๋น instance๋ ์๋ฒ ์ชฝ ๋ฐ์ดํฐ ์ฒ๋ฆฌ์ฉ์ผ๋ก ๋๊ณ , ๋์ fetchAX๋ฅผ ์ฌ์ฉํ์ฌ ๊ตฌํํ์ต๋๋ค.
export default function ResultCategoryDetailContainer({ category }: { category: ResultCategoryKey }) { | ||
const { isOpen } = useDialog(DIALOG_KEY.RESULT_CATEGORY); | ||
|
||
if (!category) return; | ||
|
||
return <>{isOpen && <ResultCategoryDetail category={category} />}</>; | ||
} |
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.
๊ธฐ์กด์ ์ปดํฌ๋ํธ์ ๋ ๋๋ง์์ isOpen
์ ๊ธฐ์ค์ผ๋ก ์ก์ง์์ ์ด์ ๋, http://localhost:3000/result?category=PRIMARY_MANDATORY_MAJOR ์ผ๋ก ๋ฐ๋ก ์ ๊ทผํ๋ ๊ฒฝ์ฐ๋ฅผ ๊ณ ๋ คํ๊ธฐ๋๋ฌธ์
๋๋ค!
- useDialog์
isOpen
์กฐ๊ฑด์ ์ ๊ฑฐํ์ฌ ์ ๊ฒฝ์ฐ๋ฅผ ๋ณด์ฅํ๊ณ ResultCategoryDetail
์if (!category) return;
์ ์ ๊ฑฐํ์ฌ ๊ฐ์ ์กฐ๊ฑด์ ํ๋ฒ๋ง ์ฒ๋ฆฌํ ์ ์๊ฒ ํ๋ ๊ฒ์ ์ด๋จ๊น์?
export default function ResultCategoryDetailContainer({ category }: { category: ResultCategoryKey }) { | |
const { isOpen } = useDialog(DIALOG_KEY.RESULT_CATEGORY); | |
if (!category) return; | |
return <>{isOpen && <ResultCategoryDetail category={category} />}</>; | |
} | |
export default function ResultCategoryDetailContainer({ category }: { category: ResultCategoryKey }) { | |
if (!category) return; | |
return <>{<ResultCategoryDetail category={category} />}</>; | |
} |
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.
- ์ฒ์์ ์ ๋ category๋ก ํํฐ๋ง์ ์๋ํ์ผ๋, category ๋ฐ์ดํฐ๊ฐ ์๋ฒ ์ธก์ ์กด์ฌํ๋ ๋ฐ์ดํฐ์ด๊ธฐ ๋๋ฌธ์ ํด๋ผ์ด์ธํธ์์ ์ง์ฐ ๋ก๋ฉ์ด ๋์ํ์ง ์์์ต๋๋ค. ๊ทธ๋์ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์๋ํ์ต๋๋ค.
- ๊ทธ๋ฐ๋ฐ ๋ง์ํ์ ๊ฒ์ฒ๋ผ URL ์ ๋ ฅ ์ ์ธ์ํ์ง ๋ชปํ๋ ๋ฌธ์ ๊ฐ ์์ด์, useEffect ์์น๋ฅผ ์กฐ์ ํ์ฌ ์์ ํ์ต๋๋ค!
|
๐storybook: https://65ccb85d5afe55a024495bc0-vfotlsvkdb.chromatic.com/ |
๐storybook: https://65ccb85d5afe55a024495bc0-vsyxmkarxg.chromatic.com/ |
๐ ์์ ๋ด์ฉ
๊ฐ์ ๊ฒฐ๊ณผ
๋ฉ์ธ ํ์ด์ง
๊ฒฐ๊ณผ ํ์ด์ง
๋ฉ์ธ ํ์ด์ง
๊ฒฐ๊ณผ ํ์ด์ง
๐ค ๊ณ ๋ฏผ ํ๋ ๋ถ๋ถ
๐ ๋์์ด ํ์ํ ๋ถ๋ถ