-
Notifications
You must be signed in to change notification settings - Fork 0
[REFACTOR] 컴포넌트 구조 정리 #221
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
Changes from 2 commits
104ac10
4033fef
bc0e509
6dd4950
7956197
d20ed5d
de917f5
a2a7cb5
62662ec
27af3e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,18 +1,64 @@ | ||||||
| import { Outlet, useLocation } from "react-router-dom"; | ||||||
| import Footer from "../components/common/Footer"; | ||||||
| import { Outlet, useLocation, useNavigate } from "react-router-dom"; | ||||||
| import Background from "../assets/icons/footer-background.svg"; | ||||||
| import Home from "../assets/icons/home.svg"; | ||||||
| import Note from "../assets/icons/note-edit.svg"; | ||||||
| import UpButton from "../components/common/UpButton"; | ||||||
| import CalendarIcon from "../components/common/icon/Calendar"; | ||||||
|
|
||||||
| export default function MobileLayout() { | ||||||
| const location = useLocation(); | ||||||
| const footerPaths = ["/", "/meal-plan"]; | ||||||
|
|
||||||
| const showFooter = footerPaths.includes(location.pathname); | ||||||
|
|
||||||
| const navigate = useNavigate(); | ||||||
|
|
||||||
| return ( | ||||||
| <div className="flex min-h-[100dvh] justify-center bg-gray-50"> | ||||||
| <div className="relative w-full max-w-[400px] bg-white shadow-md"> | ||||||
| <Outlet /> | ||||||
| {showFooter && <Footer />} | ||||||
| {showFooter && ( | ||||||
| <div className="fixed bottom-0 left-1/2 -translate-x-1/2 w-full max-w-[400px] text-[10px] font-medium z-10 text-center"> | ||||||
| <div className="relative"> | ||||||
| <img src={Background} className="w-full" alt="푸터 배경" /> | ||||||
|
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. 장식용 이미지는 스크린리더에서 제외해주세요. Line 23의 배경 이미지는 정보 전달용이 아니므로 ♿ Proposed fix- <img src={Background} className="w-full" alt="푸터 배경" />
+ <img src={Background} className="w-full" alt="" aria-hidden="true" />📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| <div className="absolute bottom-0 w-full aspect-[400/92] flex justify-between px-6"> | ||||||
| <div className="flex justify-center w-19 pt-2"> | ||||||
| <button | ||||||
| className="flex flex-col cursor-pointer gap-2" | ||||||
| onClick={() => navigate("/")} | ||||||
| > | ||||||
|
Comment on lines
+27
to
+30
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.
Line 27, Line 37, Line 47의 버튼 모두 🔧 Proposed fix <button
+ type="button"
className="flex flex-col cursor-pointer gap-2"
onClick={() => navigate("/")}
>
@@
<button
+ type="button"
className="flex flex-col items-center cursor-pointer gap-2"
onClick={() => navigate("/meal-plan")}
>
@@
<button
+ type="button"
className="
absolute left-1/2 -translate-x-1/2 bottom-[clamp(32px,calc(56/400*100vw),56px)]
flex flex-col justify-center items-center gap-1 Also applies to: 37-40, 47-55 🧰 Tools🪛 Biome (2.4.4)[error] 27-30: Provide an explicit type prop for the button element. (lint/a11y/useButtonType) 🤖 Prompt for AI Agents |
||||||
| <img src={Home} className="size-5" alt="홈 아이콘" /> | ||||||
| <p>홈</p> | ||||||
| </button> | ||||||
| </div> | ||||||
|
|
||||||
| <div className="flex flex-col items-center w-19 pt-2"> | ||||||
| <button | ||||||
| className="flex flex-col items-center cursor-pointer gap-2" | ||||||
| onClick={() => navigate("/meal-plan")} | ||||||
| > | ||||||
| <CalendarIcon size={20} /> | ||||||
| <p>식단표</p> | ||||||
| </button> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
| <button | ||||||
| className=" | ||||||
| absolute left-1/2 -translate-x-1/2 bottom-[clamp(32px,calc(56/400*100vw),56px)] | ||||||
| flex flex-col justify-center items-center gap-1 | ||||||
| w-[clamp(40px,calc(68/400*100vw),56px)] | ||||||
| h-[clamp(40px,calc(68/400*100vw),56px)] | ||||||
| rounded-full bg-primary-700 cursor-pointer" | ||||||
| onClick={() => navigate("/meal-plan/create")} | ||||||
| > | ||||||
| <img src={Note} className="size-5" alt="식단짜기 아이콘" /> | ||||||
| <p className="text-white">식단 짜기</p> | ||||||
| </button> | ||||||
| </div> | ||||||
| </div> | ||||||
| )} | ||||||
| <UpButton /> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
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.
🛠️ Refactor suggestion | 🟠 Major
상수 네이밍을 가이드에 맞게 UPPER_SNAKE_CASE로 맞춰주세요.
footerPaths는 상수 성격이므로FOOTER_PATHS로 변경하는 게 규칙에 맞고, 컴포넌트 바깥으로 올리면 불필요한 재생성도 줄일 수 있습니다.♻️ Proposed refactor
As per coding guidelines,
Constants must be UPPER_SNAKE_CASE.🤖 Prompt for AI Agents