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

Hotfix: DefaultBanner 리팩토링 #266

Merged
merged 5 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 25 additions & 11 deletions src/components/postDetail/DefaultBanner/DefaultBanner.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,36 @@
@include image-fit(cover);
}

.game-name {
@include text-style-quantico(48, $primary);
.text-container {
@include column-flexbox;
@include pos-center;

@include responsive(T) {
@include text-style-quantico(32);
}
overflow: hidden;
width: 100%;

.match-name {
@include text-style-quantico(24, $gray20, bold);

@include responsive(T) {
font-size: $font-size-16;
}

@include responsive(M) {
font-size: 24;
line-height: 3rem;
}

@include pos-center;
.game-name {
@include text-style-quantico(32, $white);

overflow: hidden;
width: 100%;
text-align: center;
@include responsive(T) {
font-size: $font-size-24;
}

@include responsive(M) {
font-size: $font-size-24;
}

line-height: 4rem;
}
}
}
}
12 changes: 9 additions & 3 deletions src/components/postDetail/DefaultBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Image from 'next/image';

import classNames from 'classnames/bind';

import { PRICE_TO_MATCH_TYPE } from '@/constants';

import { GameNameEN } from '@/types';

import styles from './DefaultBanner.module.scss';
Expand All @@ -10,15 +12,19 @@ const cx = classNames.bind(styles);

type DefaultBannerProps = {
url: string;
price: number;
gameName: GameNameEN;
};

const DefaultBanner = ({ url, gameName }: DefaultBannerProps) => {
const DefaultBanner = ({ url, price, gameName }: DefaultBannerProps) => {
return (
<div className={cx('default-banner')}>
<div className={cx('img-container')}>
<Image className={cx('img')} src={url} alt='배너 이미지' fill sizes='100%' />
<span className={cx('game-name')}>{gameName}</span>
<Image className={cx('img')} src={url} alt='배너 이미지' fill sizes='100%' priority />
<div className={cx('text-container')}>
<span className={cx('match-name')}>{PRICE_TO_MATCH_TYPE[price]}</span>
<span className={cx('game-name')}>{gameName}</span>
</div>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/postDetail/PostDetailContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const PostDetailContent = ({ isLoggedIn }: PostPageProps) => {
{isImageSlide && imageUrls ? (
<ImageSlide imageList={imageUrls} />
) : (
<DefaultBanner url={bannerImageUrl} gameName={formatCategoryToGameNameEN(category)} />
<DefaultBanner url={bannerImageUrl} price={price} gameName={formatCategoryToGameNameEN(category)} />
)}
</section>
<section className={cx('section-bottom', { 'no-flex': !isReservationAvailable })}>
Expand Down
10 changes: 9 additions & 1 deletion src/constants/games.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GameNameEN, GameNameKR } from '@/types';
import { GameNameEN, GameNameKR, MatchTypeEN } from '@/types';

export const GAME_NAME_LIST_EN: GameNameEN[] = ['LEAGUE OF LEGENDS', 'BATTLEGROUNDS', 'OVERWATCH 2', 'MINECRAFT'];
export const MATCH_TYPE_LIST_EN: MatchTypeEN[] = ['Offline Match', 'Online Match', 'Clan Recruitment', 'Game Strategy'];

export const GAME_NAME_EN_TO_KR: Record<GameNameEN, GameNameKR> = {
'LEAGUE OF LEGENDS': '리그오브레전드',
Expand Down Expand Up @@ -44,3 +45,10 @@ export const GAME_PATH_NAME_TO_GAME_NAME_EN: Record<string, string> = {
'overwatch-2': GAME_NAME_LIST_EN[2],
minecraft: GAME_NAME_LIST_EN[3],
};

export const PRICE_TO_MATCH_TYPE: Record<string, string> = {
0: MATCH_TYPE_LIST_EN[0],
1: MATCH_TYPE_LIST_EN[1],
2: MATCH_TYPE_LIST_EN[2],
3: MATCH_TYPE_LIST_EN[3],
};
2 changes: 2 additions & 0 deletions src/types/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export type GameNameEN = 'LEAGUE OF LEGENDS' | 'BATTLEGROUNDS' | 'OVERWATCH 2' |
export type LinkName = 'league-of-legends' | 'battlegrounds' | 'overwatch-2' | 'minecraft';

export type Category = '스포츠' | '투어' | '관광' | '웰빙';

export type MatchTypeEN = 'Online Match' | 'Offline Match' | 'Clan Recruitment' | 'Game Strategy';