Skip to content

Commit 312cdf0

Browse files
committed
매 페이지마다 후원사 목록 불러오도록 변경
1 parent 13d4f88 commit 312cdf0

File tree

6 files changed

+41
-15
lines changed

6 files changed

+41
-15
lines changed

frontend/assets/styles/typo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const Heading1 = styled.h1`
1010
const Heading2 = styled.h2`
1111
font-size: 1.9rem;
1212
line-height: 1.3;
13+
margin: 1.4rem 0 2rem;
1314
${(props) => {
1415
if (props.useGradient) {
1516
return `background: ${props.theme.gradient_violet};

frontend/components/layout/Layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import NavBarMobile from '../core/NavBarMobile'
44
import styled from 'styled-components'
55
import { media } from '../../assets/styles/mixin'
66
import LayoutSponsorList from './LayoutSponsorList'
7+
import { ISponsorList } from '../../interfaces/ISponsor'
78

89
interface LayoutProps {
910
locale: string
@@ -31,7 +32,7 @@ export const Background = styled.div`
3132
background-color: ${(props) => props.theme.colors.black_10};
3233
`
3334

34-
const Layout = (props: LayoutProps) => {
35+
const Layout = (props: LayoutProps & { sponsorList?: ISponsorList }) => {
3536
// TODO: locale을 context로 관리
3637
return (
3738
<Background>
@@ -40,7 +41,9 @@ const Layout = (props: LayoutProps) => {
4041
<Container>
4142
<Body>
4243
{props.children}
43-
{props.hideSponsor ?? <LayoutSponsorList />}
44+
{!props.hideSponsor && (
45+
<LayoutSponsorList list={props.sponsorList} />
46+
)}
4447
</Body>
4548
</Container>
4649
</Background>

frontend/components/layout/LayoutSponsorList.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import React from 'react'
2-
import { Heading3 } from '../../assets/styles/typo'
2+
import { Heading2 } from '../../assets/styles/typo'
33
import styled from 'styled-components'
4+
import { useTranslation } from 'react-i18next'
5+
import SponsorList from '../service/Sponsor/SponsorList'
6+
import { ISponsorList } from '../../interfaces/ISponsor'
47

58
const Container = styled.div`
69
margin-top: 8rem;
710
`
811

9-
const LayoutSponsorList = () => {
12+
const LayoutSponsorList = (props: { list: ISponsorList }) => {
13+
const { t } = useTranslation()
14+
1015
return (
1116
<Container>
12-
<Heading3 useGradient={true}>후원사 목록</Heading3>
17+
<Heading2 useGradient={true}>{t('label:sponsorList')}</Heading2>
18+
<SponsorList list={props.list} useGradientTitle={false} />
1319
</Container>
1420
)
1521
}

frontend/components/service/Sponsor/SponsorList.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ const SponsorGroup = styled.ul`
1616
flex-wrap: wrap;
1717
flex: auto;
1818
gap: 2rem;
19-
${media.mobile(`
20-
flex-direction: column;
21-
`)}
2219
`
2320

2421
const SponsorItem = styled.li`
@@ -29,6 +26,10 @@ const SponsorItem = styled.li`
2926
list-style: none;
3027
display: inline-flex;
3128
align-items: center;
29+
${media.mobile(`
30+
width: 140px;
31+
height: 140px;
32+
`)}
3233
`
3334

3435
const SponsorLink = styled.a`
@@ -42,11 +43,15 @@ const SponsorImage = styled.img`
4243
vertical-align: top;
4344
`
4445

45-
const SponsorList = (props: { list: ISponsorList }) => {
46+
const SponsorList = (props: {
47+
list: ISponsorList
48+
useGradientTitle: boolean
49+
}) => {
4650
const { t } = useTranslation()
4751
const theme = useTheme()
4852
const sponsorList: { [key: string]: ISponsorLevelItem } = {}
4953
const blackBackgroundId = [3]
54+
const useGradient = props.useGradientTitle ?? true
5055

5156
props.list.list.forEach((sponsor) => {
5257
const key = `LEVEL_${sponsor.level}`
@@ -75,7 +80,9 @@ const SponsorList = (props: { list: ISponsorList }) => {
7580
const item = sponsorList[key]
7681
return (
7782
<SponsorLevel key={key}>
78-
<Heading3 useGradient={true}>{item.name}</Heading3>
83+
<Heading3 useGradient={useGradient}>
84+
{item.name}
85+
</Heading3>
7986
<SponsorGroup>
8087
{item.list.map((sponsor) => (
8188
<SponsorItem

frontend/locales/ko/label.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ export default {
5454
eventDetail: '행사 상세',
5555
aboutEvent:
5656
'파이콘 한국은 한국의 파이썬 개발자들이 지식을 공유하고 만남을 갖기 위한 장입니다.\n파이콘 한국 2022은 온라인과 오프라인 동시에 진행됩니다.',
57-
officialFacebook: '공식 페이스북(https://www.facebook.com)'
57+
sponsorList: '후원사 목록'
5858
}

frontend/pages/_app.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,24 @@ import '../assets/styles/global.css'
88
import Theme from '../assets/styles/theme'
99
import { NextSeo } from 'next-seo'
1010
import Head from 'next/head'
11+
import { getSponsorList } from './api/sponsor'
12+
import { ISponsorList } from '../interfaces/ISponsor'
1113

1214
const App = ({
1315
Component,
1416
pageProps,
1517
locale,
16-
router
17-
}: AppProps & { locale: string }) => {
18+
router,
19+
sponsorList
20+
}: AppProps & { locale: string; sponsorList: ISponsorList }) => {
1821
const i18n = React.useMemo(() => createI18n({ locale }), [locale])
1922
const { t } = useTranslation()
2023
const { pathname } = router
2124

2225
const pageName = pageProps?.title ?? ''
2326
const description = `${t(`label:pyconkrTitle`)}: ${t(`label:pyconkrDate`)}`
2427

25-
const hideSponsor = pathname === '/sponsor'
28+
const hideSponsor = pathname.includes('/sponsor')
2629

2730
const getPageTitle = (): string => {
2831
if (i18n.exists(`pageTitle:${pageName}`)) {
@@ -61,6 +64,7 @@ const App = ({
6164
locale={locale}
6265
pageName={pageName}
6366
hideSponsor={hideSponsor}
67+
sponsorList={sponsorList}
6468
>
6569
<Component pageName={pageName} {...pageProps} />
6670
</Layout>
@@ -72,7 +76,12 @@ const App = ({
7276

7377
App.getInitialProps = async ({ ctx }: AppContext) => {
7478
const { locale } = ctx
75-
return { locale }
79+
const data = await getSponsorList()
80+
81+
return {
82+
locale,
83+
sponsorList: data
84+
}
7685
}
7786

7887
export default App

0 commit comments

Comments
 (0)