Skip to content

Commit

Permalink
[Feat] 리그 타입 별 테두리 색상 다르게 설정 및 box-shadow 적용 #1160
Browse files Browse the repository at this point in the history
  • Loading branch information
Clearsu committed Dec 14, 2023
1 parent f749c7a commit 38f7813
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
18 changes: 15 additions & 3 deletions components/tournament-record/WinnerProfileImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import styles from 'styles/tournament-record/WinnerProfileImage.module.scss';

interface WinnerProfileImageProps {
tournament: TournamentInfo;
type: string;
slideIndex: number;
setTournamentInfo: React.Dispatch<SetStateAction<TournamentInfo | undefined>>;
}

export default function WinnerProfileImage({
tournament,
type,
slideIndex,
setTournamentInfo,
}: WinnerProfileImageProps) {
Expand All @@ -35,18 +37,28 @@ export default function WinnerProfileImage({
}
}, [indexDiff, tournament, setTournamentInfo]);

function applyStyle() {
function applyLayerStyle() {
if (indexDiff === 0) {
return styles.firstLayer;
}
return styles.secondLayer;
}

function applyTypeStyle(type: string) {
if (type === 'ROOKIE') {
return styles.rookie;
}
if (type === 'MASTER') {
return styles.master;
}
return styles.custom;
}

return (
<div
className={`${styles.winnerProfileImage} ${
indexDiff > -2 && indexDiff < 2 && applyStyle()
}`}
indexDiff > -2 && indexDiff < 2 && applyLayerStyle()
} ${applyTypeStyle(type)}`}
>
<Image
src={imageUrl ?? '/image/fallBackSrc.jpeg'}
Expand Down
6 changes: 5 additions & 1 deletion components/tournament-record/WinnerSwiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ const WinnerSwiper = forwardRef(
<React.Fragment key={pageIndex}>
{page.tournaments.length > 0 &&
page.tournaments.map((tournament, index) => (
<SwiperSlide key={tournament.tournamentId}>
<SwiperSlide
className={styles.swiperSlide}
key={tournament.tournamentId}
>
<WinnerProfileImage
tournament={tournament}
type={type}
slideIndex={index + pageIndex * size}
setTournamentInfo={setTournamentInfo}
/>
Expand Down
14 changes: 13 additions & 1 deletion styles/tournament-record/WinnerProfileImage.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,26 @@
height: 100%;
overflow: hidden;
filter: brightness(50%);
border: 4px solid #e2be00;
border-radius: 1.8rem;
transition: filter 0.4s ease;
transform: translate(-50%, -50%);
animation: fadeIn 0.3s ease-in-out;

&.rookie {
border: 4px solid #e2be00;
}

&.master {
border: 4px solid #7ceeff;
}

&.custom {
border: 4px solid #7dffbe;
}

&.firstLayer {
filter: brightness(100%);
box-shadow: 0 0 15px 5px rgba(255, 247, 201, 0.75); /* 후광 효과 */
}

&.secondLayer {
Expand Down
10 changes: 6 additions & 4 deletions styles/tournament-record/WinnerSwiper.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.swiper {
height: 10rem;
margin-top: 1.7rem;
margin-bottom: 1rem;
overflow: hidden;
height: 14rem;
}

.swiperSlide {
height: 80%;
margin: 1.5rem 0;
}

0 comments on commit 38f7813

Please sign in to comment.