Skip to content

Commit 145f945

Browse files
committed
후원사 배경색 조건적으로 처리하도록 변경
1 parent ffb6cdd commit 145f945

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

frontend/components/service/Sponsor/SponsorList.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Link } from '../../core/SnsLink'
22
import React from 'react'
3-
import styled from 'styled-components'
3+
import styled, { useTheme } from 'styled-components'
44
import { ISponsorLevelItem, ISponsorList } from '../../../interfaces/ISponsor'
55
import { useTranslation } from 'react-i18next'
66
import { Heading3 } from '../../../assets/styles/typo'
@@ -22,6 +22,7 @@ const SponsorGroup = styled.ul`
2222
`
2323

2424
const SponsorItem = styled.li`
25+
background: ${(props) => props.color ?? props.theme.colors.white};
2526
max-width: 200px;
2627
height: 200px;
2728
list-style: none;
@@ -37,7 +38,9 @@ const SponsorImage = styled.img`
3738

3839
const SponsorList = (props: { list: ISponsorList }) => {
3940
const { t } = useTranslation()
41+
const theme = useTheme()
4042
const sponsorList: { [key: string]: ISponsorLevelItem } = {}
43+
const blackBackgroundId = [3]
4144

4245
props.list.list.forEach((sponsor) => {
4346
const key = `LEVEL_${sponsor.level}`
@@ -51,6 +54,13 @@ const SponsorList = (props: { list: ISponsorList }) => {
5154
sponsorList[key].list.push(sponsor)
5255
})
5356

57+
const backgroundColor = (id: number): string => {
58+
if (blackBackgroundId.includes(id)) {
59+
return theme.colors.black
60+
}
61+
return theme.colors.white
62+
}
63+
5464
return (
5565
<>
5666
{Object.keys(sponsorList)
@@ -62,7 +72,10 @@ const SponsorList = (props: { list: ISponsorList }) => {
6272
<Heading3 useGradient={true}>{item.name}</Heading3>
6373
<SponsorGroup>
6474
{item.list.map((sponsor) => (
65-
<SponsorItem key={sponsor.slug}>
75+
<SponsorItem
76+
key={sponsor.slug}
77+
color={backgroundColor(sponsor.id)}
78+
>
6679
<Link
6780
href={`/sponsor/list/${sponsor.id}`}
6881
>

0 commit comments

Comments
 (0)