Skip to content

Commit

Permalink
refactor: PNGS 상수명 WEBPS로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
CheeseB committed Apr 2, 2024
1 parent 8dc1103 commit 09a93a2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/components/landing/MatchTeam/MatchCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Dispatch, useEffect, useState } from 'react';

import classNames from 'classnames/bind';

import { GAME_NAME_KR_TO_PATH_NAME, GAME_NAME_LIST_EN, PNGS } from '@/constants';
import { GAME_NAME_KR_TO_PATH_NAME, GAME_NAME_LIST_EN, WEBPS } from '@/constants';

import { GameClassName } from '@/components/landing/MatchTeam/MatchTeam';
import { useDeviceType } from '@/hooks/useDeviceType';
Expand All @@ -14,7 +14,7 @@ import styles from './MatchCards.module.scss';

const cx = classNames.bind(styles);

const { lol, bg, ow, mc } = PNGS.match;
const { lol, bg, ow, mc } = WEBPS.match;

type MatchCardsProps = {
hoveredCard: GameClassName;
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/Banner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useRouter } from 'next/router';

import classNames from 'classnames/bind';

import { GAME_PATH_NAME_TO_GAME_NAME_EN, PNGS } from '@/constants';
import { GAME_PATH_NAME_TO_GAME_NAME_EN, WEBPS } from '@/constants';

import styles from './Banner.module.scss';

Expand All @@ -13,7 +13,7 @@ const Banner = () => {
const { game } = router.query;
if (!game) return;
const gameName = GAME_PATH_NAME_TO_GAME_NAME_EN[game as keyof typeof GAME_PATH_NAME_TO_GAME_NAME_EN];
const { url } = PNGS.banner[gameName as keyof typeof PNGS.banner];
const { url } = WEBPS.banner[gameName as keyof typeof WEBPS.banner];

return (
<section className={cx('banner')} style={{ backgroundImage: `url(${url})` }}>
Expand Down
2 changes: 1 addition & 1 deletion src/constants/images.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const PNGS = {
export const WEBPS = {
banner: {
['LEAGUE OF LEGENDS']: { url: '/images/banner-LOL.webp' },
['BATTLEGROUNDS']: { url: '/images/banner-BG.webp' },
Expand Down
4 changes: 2 additions & 2 deletions src/pages/404/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import Image from 'next/image';

import classNames from 'classnames/bind';

import { PNGS } from '@/constants';
import { WEBPS } from '@/constants';

import styles from './404.module.scss';

const cx = classNames.bind(styles);
const { url, alt } = PNGS.errorPage.error404;
const { url, alt } = WEBPS.errorPage.error404;

const Error404 = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/500/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import Image from 'next/image';

import classNames from 'classnames/bind';

import { PNGS } from '@/constants';
import { WEBPS } from '@/constants';

import styles from './500.module.scss';

const cx = classNames.bind(styles);
const { url, alt } = PNGS.errorPage.error500;
const { url, alt } = WEBPS.errorPage.error500;

const Error404 = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/error/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import Image from 'next/image';

import classNames from 'classnames/bind';

import { PNGS } from '@/constants';
import { WEBPS } from '@/constants';

import styles from './error.module.scss';

const cx = classNames.bind(styles);
const { url, alt } = PNGS.errorPage.error;
const { url, alt } = WEBPS.errorPage.error;

export type ErrorProps = {
statusCode: number | undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/gameFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CATEGORY_TO_GAME, GAME_NAME_EN_TO_KR, PNGS } from '@/constants';
import { CATEGORY_TO_GAME, GAME_NAME_EN_TO_KR, WEBPS } from '@/constants';

import { GameNameEN, LinkName } from '@/types';

Expand All @@ -11,4 +11,4 @@ export const formatCategoryToGameNameEN = (category: string) => CATEGORY_TO_GAME
export const formatCategoryToGameNameKR = (category: string) => GAME_NAME_EN_TO_KR[CATEGORY_TO_GAME[category]];

export const formatCategoryToBannerImageURL = (category: string) =>
PNGS.banner[formatCategoryToGameNameEN(category)].url;
WEBPS.banner[formatCategoryToGameNameEN(category)].url;

0 comments on commit 09a93a2

Please sign in to comment.