Closed sinji2102 closed 1 week ago
PR 작성하느라 고생 많았어요!! 라벨 잘 지정되었는지 확인 한 번 해 주기 🫶
버튼 관련해서 코드 수정해서 PR도 수정했으니 다들 잘 읽어주기!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
📌 관련 이슈번호
🎟️ PR 유형
어떤 변경 사항이 있나요?
✅ Key Changes
📢 To Reviewers
먼저 사과의 말씀 전합니다. . . 바텀시트가 뭔가 생긴 게 자꾸만 재사용 될 것 같은데 다음에 재사용될 때는 저 형식이 아닌 것 같아 잘게 컴포넌트를 쪼개다 보니까 요상한 코드가 되었어요... 엉엉... 아기개발자가 컴포넌트 분리 욕심을 내면 어떻게 되는지를 보고 계십니다...
사용법
전체적인 폴더 구조
📦components ┗ 📂commons ┃ ┣ 📂bottomSheet ┃ ┃ ┣ 📂actionsBottomSheet ┃ ┃ ┃ ┣ 📂phoneNumber ┃ ┃ ┃ ┃ ┣ 📜PhoneNumber.tsx ┃ ┃ ┃ ┃ ┃ : 휴대폰 번호 및 복사 기능 컴포넌트( action 바텀 시트가 전화번호가 아닌 정보 전달이 있을 수 있어 생성)
┃ ┃ ┃ ┃ ┗ 📜PhoneNumberStyle.tsx ┃ ┃ ┃ ┣ 📜ActionBottomSheet.tsx ┃ ┃ ┃ : Action 바텀 시트. 큰 제목과 sub title 포함 ┃ ┃ ┃ ┗ 📜ActionBottomSheetStyle.tsx ┃ ┃ ┣ 📂viewBottomSheet ┃ ┃ ┃ ┣ 📜ViewBottomSheet.tsx ┃ ┃ ┃ : View 바텀 시트. 큰 제목 및 작은 제목 포함. ContextBox이 포함되어 있고 children으로 Context를 받아야 함 ┃ ┃ ┃ ┗ 📜ViewBottomSheetStyle.tsx ┃ ┃ ┣ 📜BottomSheet.tsx ┃ ┃ : 가장 틀이 되는 (가장 큰) 바텀 시트. 타이틀만 포함되며 ViewBottomSheet와 AcionBottomSheet에서 제목을 받음 ┃ ┃ ┗ 📜BottomSheetStyle.tsx ┃ ┗ 📂contextBox ┃ ┃ ┣ 📜Context.tsx ┃ ┃ : Context가 쓰이는 개수가 바텀 시트마다 달라서 따로 제작. ┃ ┃ ┣ 📜ContextBox.tsx ┃ ┃ : ContextBox마다 들어가는 내용도 다르고 크기도 달라 커스텀 할 수 있도록 제작. ┃ ┃ ┣ 📜ContextBoxStyle.tsx ┃ ┃ ┗ 📜ContextStyle.tsx
너무,, 복잡해서 간략하게 설명해 두었습니다,,,
View Bottom Sheet
바텀 시트 내에 몇 개의 항목이 들어갈지 몰라 내용이 들어가는 부분을 Context로 분리해두었습니다!
때문에 사용할 때 ViewBottomSheet 안에 Context를 Children으로 넣어줘야 합니다.
날짜의 경우 양식이 조금 달라 Context에 isDate=true 및 subTitle, date, time을 props로 넘겨줘야 합니다!
위 캡처본과 같은 사용 예제
const ViewBottomSheetTest = () => { const [isOpen, setIsOpen] = useState(false);
const handleSheetOpen = () => { setIsOpen(true); };
const handleSheetClose = () => { setIsOpen(false); };
return (
); };
export default ViewBottomSheetTest;
const Test = styled.div` width: 37.5rem; height: 660.7rem;
background-color: white; `;
import styled from "styled-components"; import { useState } from "react"; import ActionBottomSheet from "@components/commons/bottomSheet/actionsBottomSheet/ActionBottomSheet"; import PhoneNumber from "@components/commons/bottomSheet/actionsBottomSheet/phoneNumber/PhoneNumber"; import Button from "@components/commons/button/Button"; import OuterLayout from "@components/commons/bottomSheet/OuterLayout";
const ActionBottomSheetTest = () => { const [isOpen, setIsOpen] = useState(false);
const handleSheetOpen = () => { setIsOpen(true); };
const handleSheetClose = () => { setIsOpen(false); };
return (
); };
export default ActionBottomSheetTest;
const Test = styled.div` width: 37.5rem; height: 66.7rem;
background-color: white; `;