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 : PosterWithButton 컴포넌트 구현 #137

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d690596
Feat:PosterWithButtons컴포넌트구현, Heart버튼제외
jymaeng1234 Oct 2, 2024
62dd70e
Feat: CrownIcon 컴포넌트 구현
se0kcess Sep 29, 2024
246ce0b
Feat: FilterButtonContainer 구현
se0kcess Sep 27, 2024
c19fd24
Fix: 오타수정 및 StyledSeperator border 제거
se0kcess Sep 27, 2024
2d448b4
Refactor: onClick 이중 화살표 함수 패턴으로 변경
se0kcess Sep 27, 2024
4b7b0b0
Refactor: 코드 수정
se0kcess Sep 30, 2024
d271298
Refactor: onClick 함수명 수정
se0kcess Oct 1, 2024
8564dd4
Refactor: SquareButtonContainer 변수 네이밍
shlee9999 Oct 1, 2024
c6f47b7
Chore: Footer에 필요한 imgs 추가
bluedog129 Oct 1, 2024
ec676b2
Chore: imgs 변경
bluedog129 Oct 1, 2024
a22f465
Feat: Footer 컴포넌트 구현
bluedog129 Oct 1, 2024
e8c9dab
Feat: Footer style 구현
bluedog129 Oct 1, 2024
bef8dc2
Feat: Footer컴포넌트 router에 적용
bluedog129 Oct 1, 2024
3a15d6b
Fix: 가상요소 border 수정 및 border-top 추가
bluedog129 Oct 1, 2024
f3cbbcf
Fix: 컴포넌트 최적화
bluedog129 Oct 2, 2024
0254c12
Feat: StyledFooter컴포넌트로 Footer에 max-width 지정
bluedog129 Oct 2, 2024
8ab5754
Fix: 불필요한 style 옵션 제거
bluedog129 Oct 2, 2024
685ac76
Feat: HeartButton 컴포넌트 구현
se0kcess Sep 27, 2024
34090c0
Refactor: Clicked -> Filled로 수정
se0kcess Sep 30, 2024
45c1de5
Refactor: Clicked -> Filled로 수정
se0kcess Oct 2, 2024
f8d173a
Refactor: 네이밍 수정
se0kcess Oct 2, 2024
7a245ad
Feat: PosterGallery 컴포넌트 구현
juriurj Sep 30, 2024
9a20751
Feat: PosterWithDesc 컴포넌트 공연장 추가
juriurj Sep 30, 2024
8140826
Feat: width, height 숫자 추출 함수 구현
juriurj Oct 1, 2024
45f5f36
Refactor: Poster 컴포넌트 props 수정
juriurj Oct 1, 2024
1665270
Docs: PosterGallery 컴포넌트 pList타입 정리
juriurj Oct 1, 2024
0992b6c
Refactor: Poster 컴포넌트 props 타입 변경
juriurj Oct 1, 2024
7422622
Refactor: Poster 관련 컴포넌트 정리
juriurj Oct 1, 2024
2751a96
Refactor: PosterGallery 컴포넌트 닫는 방법 수정
juriurj Oct 1, 2024
d7a59bd
Feat: RankIcon 컴포넌트 구현
se0kcess Oct 1, 2024
63ceab9
Refactor: getRankColor 함수 이동
se0kcess Oct 2, 2024
fa2af90
Feat: NoResultIcon 컴포넌트 구현
se0kcess Oct 1, 2024
da862d8
Refactor: 컴포넌트 네이밍 수정
se0kcess Oct 2, 2024
fc44001
Feat: Loader
shlee9999 Oct 2, 2024
4e626c7
Feat: PTrailerVideo 컴포넌트 구현
juriurj Oct 1, 2024
6a7a974
Refactor: PTrailerVideo 컴포넌트 props 이름 수정
juriurj Oct 1, 2024
d2aa4c7
Feat: PTrailerVideo 컴포넌트 영상 반응형 적용
juriurj Oct 1, 2024
1f7412d
Refactor: ptrailervideo 필요없는 div 삭제
juriurj Oct 2, 2024
0a18a27
Feat: PTrailerDesc 컴포넌트 구현
juriurj Oct 2, 2024
070cce4
Feat: LocalDateTime 컴포넌트 구현
se0kcess Oct 2, 2024
3d5f3db
Refactor: 코드 구조 수정
se0kcess Oct 2, 2024
47a0665
Feat: PItem 컴포넌트 구현
se0kcess Oct 1, 2024
95a502e
"Refactor: 공연 장소 변수명 location으로 변경"
se0kcess Oct 1, 2024
9e51495
Refactor: PItemContainer 코드 리팩토링
se0kcess Oct 1, 2024
cbdcc3c
Refactor: 코드 수정
se0kcess Oct 2, 2024
49e1231
Refactor: Poster 컴포넌트 적용
se0kcess Oct 2, 2024
c2c979b
Refactor: 컴포넌트 구조 변경
se0kcess Oct 2, 2024
67c923a
Refactor: Loader 컴포넌트 추가, 코드 구조 수정
se0kcess Oct 2, 2024
7cf50b7
Feat:HeartButton 추가
jymaeng1234 Oct 2, 2024
af26604
Fix : props 설정 수정
jymaeng1234 Oct 2, 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
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@types/xml-js": "^1.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-loader-spinner": "^6.1.6",
"react-router-dom": "^6.26.2",
"styled-components": "^6.1.13",
"vite-tsconfig-paths": "^5.0.1",
Expand Down
Binary file added src/assets/imgs/interpark-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/imgs/kopis-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/imgs/noResultIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/imgs/yes24-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/components/CrownIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as S from './styles';
import { faCrown } from '@fortawesome/free-solid-svg-icons';

export const CrownIcon = () => {
return <S.CrownIcon icon={faCrown} />;
};
11 changes: 11 additions & 0 deletions src/components/CrownIcon/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import styled from 'styled-components';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

export const CrownIcon = styled(FontAwesomeIcon)`
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
color: ${({ theme }) => theme.colors.yellow};
`;
28 changes: 28 additions & 0 deletions src/components/FilterButtonContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as S from './styles';
import { useState } from 'react';
import { FilterButton } from '@/components/FilterButton';

interface FilterButtonContainerProps {
buttonList: string[];
onFilterChange?: (index: number) => void;
}

export const FilterButtonContainer = ({ buttonList, onFilterChange }: FilterButtonContainerProps) => {
const [activeItem, setActiveItem] = useState(0);

const onClick = (index: number) => () => {
setActiveItem(index);
onFilterChange?.(index);
};

return (
<S.FilterButtonContainer>
{buttonList.map((text, index) => (
<S.FilterButtonWrapper>
<FilterButton key={index} text={text} $isActive={index === activeItem} onClick={onClick(index)} />
{index < buttonList.length - 1 && <S.StyledSeperator />}
</S.FilterButtonWrapper>
))}
</S.FilterButtonContainer>
);
};
22 changes: 22 additions & 0 deletions src/components/FilterButtonContainer/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Seperator } from '@/components/Seperator';
import styled from 'styled-components';

export const FilterButtonContainer = styled.div`
display: flex;
border: none;
`;

export const FilterButtonWrapper = styled.div`
display: flex;
align-items: center;
position: relative;
`;

export const StyledSeperator = styled(Seperator)`
display: flex;
align-items: center;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
`;
25 changes: 25 additions & 0 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as S from './styles';
import interparkLogo from '@/assets/imgs/interpark-logo.png';
import kopisLogo from '@/assets/imgs/kopis-logo.png';
import yes24Logo from '@/assets/imgs/yes24-logo.png';
const logoList = [
{ href: 'https://www.interpark.com', alt: 'interpark', src: interparkLogo },
{ href: 'https://www.kopis.or.kr', alt: 'KOPIS', src: kopisLogo },
{ href: 'https://www.yes24.com', alt: 'YES24', src: yes24Logo },
];
export const Footer = () => {
return (
<S.FooterContainer>
<S.StyledFooter>
{logoList.map((logo, index) => (
<>
<a href={logo.href} target="_blank" rel="noopener noreferrer">
<S.Logo src={logo.src} alt={logo.alt} />
</a>
{index < logoList.length - 1 && <S.StyledSeperator />}
</>
))}
</S.StyledFooter>
</S.FooterContainer>
);
};
28 changes: 28 additions & 0 deletions src/components/Footer/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Seperator } from '@/components/Seperator';
import styled from 'styled-components';

export const FooterContainer = styled.footer`
border-top: 1px solid ${({ theme }) => theme.colors.gray};
`;

export const StyledFooter = styled.div`
max-width: ${props => props.theme.layout.max_width};
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
& > a {
padding: 0 10px;
}
`;

export const StyledSeperator = styled(Seperator)`
height: 20px;
`;

export const Logo = styled.img`
height: 35px;
width: 110px;
object-fit: contain;
margin: 10px 5px;
`;
23 changes: 23 additions & 0 deletions src/components/HeartButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useState } from 'react';
import { faHeart as farHeart } from '@fortawesome/free-regular-svg-icons';
import { faHeart as fasHeart } from '@fortawesome/free-solid-svg-icons';
import * as S from './styles';

interface HeartButtonProps {
initialFilled?: boolean;
onClickHeartButton?: (isFilled: boolean) => void;
}

export const HeartButton = ({ initialFilled = false, onClickHeartButton }: HeartButtonProps) => {
const [isFilled, setIsFilled] = useState(initialFilled);

const onClick = () => {
const newFilledState = !isFilled;
setIsFilled(prev => !prev);
if (onClickHeartButton) {
onClickHeartButton(newFilledState);
}
};

return <S.HeartButton icon={isFilled ? fasHeart : farHeart} $isFilled={isFilled} onClick={onClick} />;
};
9 changes: 9 additions & 0 deletions src/components/HeartButton/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { styled } from 'styled-components';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

export const HeartButton = styled(FontAwesomeIcon)<{ $isFilled: boolean }>`
color: ${({ theme, $isFilled }) => ($isFilled ? theme.colors.primary : theme.colors.gray)};
cursor: pointer;
transition: color 0.1s ease;
font-size: 18px;
`;
6 changes: 6 additions & 0 deletions src/components/Loader/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import theme from '@/styles/theme';
import { FidgetSpinnerProps, ThreeDots } from 'react-loader-spinner';

export const Loader = ({ ...rest }: FidgetSpinnerProps) => {
return <ThreeDots color={theme.colors.primary} {...rest} />;
};
22 changes: 22 additions & 0 deletions src/components/LocalDateTime/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useEffect, useState } from 'react';
import * as S from './styles';

export const LocalDateTime = () => {
const [renderDateTime, setRenderDateTime] = useState('');

useEffect(() => {
const currentTime = new Date();
const dateTimeFormat = new Intl.DateTimeFormat('ko-KR', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
hour12: false,
}).format(currentTime);

setRenderDateTime(dateTimeFormat + ' 기준');
}, []);

return <S.LocalDateTime>{renderDateTime}</S.LocalDateTime>;
};
6 changes: 6 additions & 0 deletions src/components/LocalDateTime/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { P16 } from '@/components/Text';
import styled from 'styled-components';

export const LocalDateTime = styled(P16)`
color: ${({ theme }) => theme.colors.text_gray};
`;
10 changes: 8 additions & 2 deletions src/components/MenuItemContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ import { Seperator } from '@/components/Seperator';

interface MenuItemContainerProps {
menuItemList: string[];
onMenuItemChange?: (index: number) => void;
}

export const MenuItemContainer = ({ menuItemList }: MenuItemContainerProps) => {
export const MenuItemContainer = ({ menuItemList, onMenuItemChange }: MenuItemContainerProps) => {
const [activeItem, setActiveItem] = useState(0);

const onClick = (index: number) => () => {
setActiveItem(index);
onMenuItemChange?.(index);
};

return (
<S.MenuItemContainer>
{menuItemList.map((item, index) => (
<S.MenuItemWrapper>
<MenuItem key={item} item={item} active={index === activeItem} onClick={() => setActiveItem(index)} />
<MenuItem key={item} item={item} active={index === activeItem} onClick={onClick(index)} />
{index < menuItemList.length - 1 && <Seperator />}
</S.MenuItemWrapper>
))}
Expand Down
10 changes: 10 additions & 0 deletions src/components/NoResultIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as S from './styles';

export const NoResultIcon = () => {
return (
<S.NoResultContainer>
<S.NoResultIcon src="src/assets/imgs/noResultIcon.svg" alt="noResultLogo" />
<S.NoResultText>검색 결과가 존재하지 않습니다.</S.NoResultText>
</S.NoResultContainer>
);
};
19 changes: 19 additions & 0 deletions src/components/NoResultIcon/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { H32 } from '@/components/Text';
import styled from 'styled-components';

export const NoResultContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
`;

export const NoResultIcon = styled.img`
width: 200px;
height: 200px;
`;

export const NoResultText = styled(H32)`
margin-top: 2rem;
color: ${({ theme }) => theme.colors.black};
`;
28 changes: 28 additions & 0 deletions src/components/PItem/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { HeartButton } from '@/components/HeartButton';
import * as S from './styles';
import { Poster } from '@/components/Poster';
interface PItemProps {
id: string;
rank: number;
title: string;
area: string;
location: string;
period: string;
posterUrl: string;
}

export const PItem = ({ rank, title, location, period, posterUrl, area }: PItemProps) => {
return (
<S.ItemContainer>
<S.Rank>{rank}</S.Rank>
{posterUrl && <Poster src={posterUrl} width="90px" rank={rank} />}
<S.InfoContainer>
<S.Title>{title}</S.Title>
<S.Info>{area}</S.Info>
<S.Info>{location}</S.Info>
<S.Info>{period}</S.Info>
</S.InfoContainer>
<HeartButton />
</S.ItemContainer>
);
};
33 changes: 33 additions & 0 deletions src/components/PItem/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { H16, H24, P14 } from '@/components/Text';
import styled from 'styled-components';

export const ItemContainer = styled.div`
display: flex;
align-items: center;
padding: 16px;
border-bottom: 1px solid ${({ theme }) => theme.colors.gray};
`;

export const Rank = styled(H24)`
width: 40px;
text-align: center;
margin-right: 24px;
`;

export const InfoContainer = styled.div`
display: flex;
flex: 1;
justify-content: space-between;
align-items: center;
margin-left: 24px;
`;

export const Title = styled(H16)`
flex: 2;
`;

export const Info = styled(P14)`
flex: 1;
text-align: center;
color: ${({ theme }) => theme.colors.text_gray};
`;
32 changes: 32 additions & 0 deletions src/components/PItemContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Loader } from '@/components/Loader';
import * as S from './styles';
import { PItem } from '@/components/PItem';
import { CommonResponseType } from '@/types/apis';

interface PItemContainerProps {
data: Pick<CommonResponseType, 'mt20id' | 'prfnm' | 'fcltynm' | 'prfpdfrom' | 'prfpdto' | 'poster' | 'area'>[];
isLoading: boolean;
}

export const PItemContainer = ({ data, isLoading }: PItemContainerProps) => {
if (isLoading) {
return <Loader />;
}

return (
<S.PItemContainer>
{data.map((item, index) => (
<PItem
key={item.mt20id}
rank={index + 1}
id={item.mt20id}
title={item.prfnm}
location={item.fcltynm}
period={`${item.prfpdfrom} ~ ${item.prfpdto}`}
posterUrl={item.poster}
area={item.area}
/>
))}
</S.PItemContainer>
);
};
6 changes: 6 additions & 0 deletions src/components/PItemContainer/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { styled } from 'styled-components';

export const PItemContainer = styled.div`
width: 100%;
margin: 0 auto;
`;
Loading
Loading