Skip to content
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

[Feat/#84] 회원/비회원 예매 페이지 추가 #105

Merged
merged 32 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1e40601
feat: 더미데이터 추가
pepperdad Jul 10, 2024
56035c3
feat: Info 컴포넌트 추가
pepperdad Jul 10, 2024
6235615
feat: 기본 폰트 색상 흰색으로 변경
pepperdad Jul 10, 2024
eecd1e1
feat: Count 컴포넌트 추가
pepperdad Jul 10, 2024
7c92593
Merge branch 'develop' of https://github.com/TEAM-BEAT/BEAT-Client in…
pepperdad Jul 10, 2024
5cb0293
feat: 예매자 정보 BookerInfo 컴포넌트 추가
pepperdad Jul 10, 2024
3d8d721
Merge branch 'develop' of https://github.com/TEAM-BEAT/BEAT-Client in…
pepperdad Jul 10, 2024
9e16aaf
feat: 예약 페이지 라우팅 추가
pepperdad Jul 10, 2024
14fc759
feat: TextField 컴포넌트에서 TextClear 렌더링 조건 변경
pepperdad Jul 10, 2024
02980c3
fix: TextField 컴포넌트에 hasText 상태 제거
pepperdad Jul 10, 2024
784aa71
feat: performanceId 파라미터로 받을 수 있도록 라우팅 변경
pepperdad Jul 11, 2024
7a09ba9
feat: 인포박스 IconText 변경
pepperdad Jul 11, 2024
7f37f76
feat: 약관 동의 컴포넌트 추가
pepperdad Jul 11, 2024
0616c02
feat: 예매자 정보 props로 값 변경할 수 있도록 변경
pepperdad Jul 11, 2024
cd76a33
feat: ViewBottomSheet 스타일 변경
pepperdad Jul 11, 2024
c92f8a1
feat: TermCheck컴포넌트에 props 받도록 변경
pepperdad Jul 11, 2024
666b1b0
feat: BottomSheet 컴포넌트에 isOpen props 및 애니메이션 추가
pepperdad Jul 11, 2024
14bca57
feat: ViewBottomSheet 컴포넌트 애니메이션 추가
pepperdad Jul 11, 2024
946a4c2
feat: ActionBottomSheet 컴포넌트 애니메이션 추가
pepperdad Jul 11, 2024
eb4e2a0
feat: Select 컴포넌트 Radio 버튼으로 구현
pepperdad Jul 11, 2024
fd28f49
feat: Divider 추가
pepperdad Jul 11, 2024
d8b028b
feat: 잔여 티켓 5개 이하 조건에 따라 보이는 뷰 변경
pepperdad Jul 11, 2024
30a7a05
feat: 티켓 매진일 시 텍스트 추가
pepperdad Jul 11, 2024
03ccfe2
feat: 회원 예매 요청 request 형식에 맞도록 formData 추가
pepperdad Jul 11, 2024
0328f2c
feat: 비회원 예매 로직 추가
pepperdad Jul 11, 2024
160b257
feat: 비회원 이용약관 추가 및 약관 링크 연결
pepperdad Jul 11, 2024
4aae43a
feat: navigte test
pepperdad Jul 12, 2024
7b89767
Merge branch 'develop' of https://github.com/TEAM-BEAT/BEAT-Client in…
pepperdad Jul 14, 2024
fac7645
feat: 간편 비밀번호 input에 password 타입 추가
pepperdad Jul 14, 2024
b5c86b2
fix: 불필요한 함수 삭제
pepperdad Jul 14, 2024
61a8138
refactor: styled 파일로 스타일링 코드 분리
pepperdad Jul 14, 2024
1470b6b
fix: formData 타입 변경
pepperdad Jul 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/components/commons/bottomSheet/BottomSheet.styled.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import styled from "styled-components";
import styled, { keyframes } from "styled-components";

export const BottomSheetWrapper = styled.section`
position: fixed;
const bottomSheetUp = keyframes`
0% { transform: translateY(100%); }
100% { transform: translateY(0); }
`;

Comment on lines +1 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5) css 에서 @Keyframe 으로 정의하던 애니메이션을 styled-components에서는 keyframe 이라는 템플릿 리터럴 함수를 사용해서 정의하는군요! 하나 배워 갑니다 !!

const bottomSheetDown = keyframes`
0% { transform: translateY(0); }
100% { transform: translateY(100%); }
`;

export const BottomSheetWrapper = styled.section<{ $isOpen: boolean }>`
position: absolute;
bottom: 0;
z-index: 1;
left: 0;
z-index: 10;
display: flex;
justify-content: center;
width: 100%;

animation: ${({ $isOpen }) => ($isOpen ? bottomSheetUp : bottomSheetDown)} 250ms ease-in-out;
`;

export const BottomSheetLayout = styled.section`
Expand Down
5 changes: 3 additions & 2 deletions src/components/commons/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { ReactNode } from "react";
import * as S from "./BottomSheet.styled";

export interface BottomSheetPropType {
isOpen: boolean;
children?: ReactNode;
title?: string;
}

const BottomSheet = ({ title, children }: BottomSheetPropType) => {
const BottomSheet = ({ isOpen, title, children }: BottomSheetPropType) => {
return (
<S.BottomSheetWrapper onClick={(e) => e.stopPropagation()}>
<S.BottomSheetWrapper $isOpen={isOpen}>
<S.BottomSheetLayout>
<S.Title>{title}</S.Title>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@ import styled from "styled-components";

import { IcomCopy } from "@assets/svgs";

export const ActionBottomSheetWrapper = styled.section`
export const ActionBottomSheetWrapper = styled.section<{ $isOpen: boolean }>`
position: fixed;
top: 0;
bottom: 0;
left: auto;
z-index: 30;
display: flex;
justify-content: center;
width: 100%;
height: 100%;

background-color: rgb(0 0 0 / 50%);
visibility: ${({ $isOpen }) => ($isOpen ? "visible" : "hidden")};
opacity: ${({ $isOpen }) => ($isOpen ? 1 : 0)};

transition:
opacity 250ms ease-in-out,
visibility 250ms ease-in-out;
Comment on lines +14 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5) visibility 라는 속성을 처음 알았는데 굉장히 유용하네요! 눈에는 안 보여도 공간을 차지할 수 있다는 점이 활용도가 높은 것 같아요. display: block | none 만 사용했는데, 나중에 저도 활용해볼게요 !

transition으로 부드러운 css 효과 지정한다음 부드럽게 사라지게 만든 것도 좋습니다~ 센스 굿굿 👍

`;

export const SubTitle = styled.h2`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import OuterLayout from "@components/commons/bottomSheet/OuterLayout";
import ContextBox from "@components/commons/contextBox/ContextBox";
import { ContextBoxStyle } from "@typings/contextBoxProps";

import React, { ReactNode, Children, isValidElement } from "react";
import React, { Children, isValidElement, ReactNode, useEffect } from "react";

interface ActionBottomSheetProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
ContextBoxStyle {
isOpen: boolean;
title?: string;
subTitle?: string;
children?: ReactNode;
onClickOutside: () => void;
}

const ActionBottomSheet = ({
isOpen,
title,
subTitle,
onClickOutside,
Expand All @@ -37,9 +39,20 @@ const ActionBottomSheet = ({
onClickOutside();
};

useEffect(() => {
if (isOpen) {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "auto";
}
return () => {
document.body.style.overflow = "auto";
};
}, [isOpen]);
Comment on lines +42 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5) 저도 예전에 스크롤 방지하는 코드를 작성했어야 했는데, 도영님 코드 보고 궁금해서 좀 더 찾아봤어요!

다른 요소들은 그 크기를 넘어서는 순간 overflow가 되는거고, 스크롤바가 생기는 것이 기본인데
body의 경우 뷰포트를 넘어서면 overflow로 인식되고 스크롤바가 생긴다고 하더라구요!

그 지식을 활용해서 애초에 document.body.style.overflow = "hidden" 으로 만들어서 스크롤이 생기지 않게 만들고,
스크롤 자체를 방지한다는 아이디어 너무 좋은 것 같아요. 저번 합세 떄는 무식하게 body의 크기를 제한하고 overflow: "hidden" 으로 설정했는데 정말 코드 깔끔하고 좋은 것 같습니다 ! 많이 배워가요 😊


return (
<S.ActionBottomSheetWrapper onClick={handleWrapperClick}>
<BottomSheet title={title}>
<S.ActionBottomSheetWrapper $isOpen={isOpen} onClick={handleWrapperClick}>
<BottomSheet isOpen={isOpen} title={title}>
<ContextBox {...rest}>
<S.SubTitle>{subTitle}</S.SubTitle>
{innerChildren}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import styled from "styled-components";

import { BoxTitleStyle, BoxDividerStyle } from "@typings/contextBoxProps";
import { BoxDividerStyle, BoxTitleStyle } from "@typings/contextBoxProps";

export const ViewBottomSheetWrapper = styled.section`
export const ViewBottomSheetWrapper = styled.section<{ $isOpen: boolean }>`
position: fixed;
top: 0;
bottom: 0;
left: auto;
z-index: 30;
display: flex;
justify-content: center;
width: 100%;
height: 100%;

background-color: rgb(0 0 0 / 50%);
visibility: ${({ $isOpen }) => ($isOpen ? "visible" : "hidden")};
opacity: ${({ $isOpen }) => ($isOpen ? 1 : 0)};

transition:
opacity 250ms ease-in-out,
visibility 250ms ease-in-out;
`;

export const BoxTitle = styled.h1<BoxTitleStyle>`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as S from "./ViewBottomSheet.styled";
import BottomSheet from "@components/commons/bottomSheet/BottomSheet";
import OuterLayout from "@components/commons/bottomSheet/OuterLayout";
import ContextBox from "@components/commons/contextBox/ContextBox";
import * as S from "./ViewBottomSheet.styled";

import { ReactNode, Children, isValidElement } from "react";
import { Children, isValidElement, ReactNode, useEffect } from "react";

interface ViewBottomSheetProps {
isOpen: boolean;
title?: string;
boxTitle?: string;
boxTitleColor?: string;
Expand All @@ -14,6 +15,7 @@ interface ViewBottomSheetProps {
}

const ViewBottomSheet = ({
isOpen,
title,
boxTitle,
boxTitleColor,
Expand All @@ -35,9 +37,20 @@ const ViewBottomSheet = ({
onClickOutside();
};

useEffect(() => {
if (isOpen) {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "auto";
}
return () => {
document.body.style.overflow = "auto";
};
}, [isOpen]);

return (
<S.ViewBottomSheetWrapper onClick={handleWrapperClick}>
<BottomSheet title={title}>
<S.ViewBottomSheetWrapper $isOpen={isOpen} onClick={handleWrapperClick}>
<BottomSheet isOpen={isOpen} title={title}>
<ContextBox {...rest}>
<S.BoxTitle customColor={boxTitleColor}>{boxTitle}</S.BoxTitle>
<S.BoxDivider />
Expand Down
3 changes: 2 additions & 1 deletion src/components/commons/input/textField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const TextField = ({
},
} as ChangeEvent<HTMLInputElement>;

inputRef.current.focus();
onChange(newEvent);
}
};
Expand All @@ -85,8 +86,8 @@ const TextField = ({
<S.TextFieldWrapper>
<S.TextFieldInput
ref={inputRef}
name={name}
value={value}
name={name}
onChange={handleOnInput}
maxLength={maxLength}
placeholder={placeholder}
Expand Down
44 changes: 23 additions & 21 deletions src/pages/ActionBottomSheetTest.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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";
import Button from "@components/commons/button/Button";
import { useState } from "react";
import styled from "styled-components";

const ActionBottomSheetTest = () => {
const [isOpen, setIsOpen] = useState(false);
Expand All @@ -19,31 +19,33 @@ const ActionBottomSheetTest = () => {
return (
<Test>
<button onClick={handleSheetOpen}>dd</button>
{isOpen && (
<ActionBottomSheet
onClickOutside={handleSheetClose}
title="title"
subTitle="sub title"
alignItems="center"
padding="2rem 2rem 2.4rem 2rem"
>
<PhoneNumber phone="010-XXXX-XXXX" />
<OuterLayout margin="1.6rem 0 0 0">
<Button variant="primary" size="xlarge">
확인했어요
</Button>
</OuterLayout>
</ActionBottomSheet>
)}

<ActionBottomSheet
isOpen={isOpen}
onClickOutside={handleSheetClose}
title="title"
subTitle="sub title"
alignItems="center"
padding="2rem 2rem 2.4rem 2rem"
>
<PhoneNumber phone="010-XXXX-XXXX" />
<OuterLayout margin="1.6rem 0 0 0">
<Button variant="primary" size="xlarge">
확인했어요
</Button>
</OuterLayout>
</ActionBottomSheet>
</Test>
);
};

export default ActionBottomSheetTest;

const Test = styled.div`
width: 37.5rem;
height: 66.7rem;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 2.4rem;

background-color: white;
`;
52 changes: 27 additions & 25 deletions src/pages/ViewBottomSheetTest.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import styled from "styled-components";
import OuterLayout from "@components/commons/bottomSheet/OuterLayout";
import ViewBottomSheet from "@components/commons/bottomSheet/viewBottomSheet/ViewBottomSheet";
import Context from "@components/commons/contextBox/Context";
import Button from "@components/commons/button/Button";
import OuterLayout from "@components/commons/bottomSheet/OuterLayout";
import Context from "@components/commons/contextBox/Context";
import { useState } from "react";
import styled from "styled-components";

const ViewBottomSheetTest = () => {
const [isOpen, setIsOpen] = useState(false);
Expand All @@ -19,35 +19,37 @@ const ViewBottomSheetTest = () => {
return (
<Test>
<button onClick={handleSheetOpen}>dd</button>
{isOpen && (
<ViewBottomSheet
onClickOutside={handleSheetClose}
title="title"
boxTitle="공연 제목"
boxTitleColor="pink_200"
>
<Context isDate={true} subTitle="날짜" date="20XX. XX. XX" time="XX:XX" />
<Context subTitle="가격" text="100,000원 (2매)" />
<Context subTitle="예매자" text="서지우" />
<OuterLayout gap="1.1rem" margin="2.4rem 0 0 0">
<Button variant="gray" size="medium">
다시 할게요
</Button>
<Button variant="primary" size="medium">
예매할게요
</Button>
</OuterLayout>
</ViewBottomSheet>
)}

<ViewBottomSheet
isOpen={isOpen}
onClickOutside={handleSheetClose}
title="title"
boxTitle="공연 제목"
boxTitleColor="pink_200"
>
<Context isDate={true} subTitle="날짜" date="20XX. XX. XX" time="XX:XX" />
<Context subTitle="가격" text="100,000원 (2매)" />
<Context subTitle="예매자" text="서지우" />
<OuterLayout gap="1.1rem" margin="2.4rem 0 0 0">
<Button variant="gray" size="medium">
다시 할게요
</Button>
<Button variant="primary" size="medium">
예매할게요
</Button>
</OuterLayout>
</ViewBottomSheet>
</Test>
);
};

export default ViewBottomSheetTest;

const Test = styled.div`
width: 37.5rem;
height: 660.7rem;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 2.4rem;

background-color: white;
`;
26 changes: 26 additions & 0 deletions src/pages/book/Book.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import styled from "styled-components";

export const ContentWrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
padding: 0 2.4rem;
`;

export const Divider = styled.div`
width: 375px;
height: 8px;
margin-top: 1.6rem;

background: ${({ theme }) => theme.colors.gray_800};
opacity: 0.6;
border: 1px s;
`;

export const FooterContainer = styled.div`
position: sticky;
bottom: 0;
padding: 2.4rem;

background-color: ${({ theme }) => theme.colors.gray_900};
`;
Loading
Loading