Skip to content

Commit 03470e1

Browse files
committed
키노트 데이터 추가, endpoint 변경 예정
1 parent 145f945 commit 03470e1

File tree

4 files changed

+120
-12
lines changed

4 files changed

+120
-12
lines changed

frontend/components/service/Program/CategoryList.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ICategoryListItem, ITalkList } from '../../../interfaces/IProgram'
33
import styled from 'styled-components'
44
import { Heading3 } from '../../../assets/styles/typo'
55
import CategoryListItem from './CategoryListItem'
6+
import Resources from '../../../data/constants/resources'
67

78
const CategoryBlock = styled.ul`
89
& + & {
@@ -14,10 +15,15 @@ const CategoryList = (props: { list: ITalkList }) => {
1415
const categoryList: { [key: string]: ICategoryListItem } = {}
1516

1617
props.list.list.forEach((talk) => {
17-
if (!categoryList.hasOwnProperty(talk.category)) {
18-
categoryList[talk.category] = { name: talk.category, talkList: [] }
18+
if (talk.category !== Resources.KEYNOTE_CATEGORY) {
19+
if (!categoryList.hasOwnProperty(talk.category)) {
20+
categoryList[talk.category] = {
21+
name: talk.category,
22+
talkList: []
23+
}
24+
}
25+
categoryList[talk.category].talkList.push(talk)
1926
}
20-
categoryList[talk.category].talkList.push(talk)
2127
})
2228

2329
return (
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React from 'react'
2+
import styled from 'styled-components'
3+
import { ITalkItem } from '../../../interfaces/IProgram'
4+
import { media } from '../../../assets/styles/mixin'
5+
import { Heading3 } from '../../../assets/styles/typo'
6+
import { DEFAULT_PROFILE_PATH } from '../../../data/constants/config'
7+
import { Link } from '../../core/SnsLink'
8+
9+
const ListItem = styled.div`
10+
& + & {
11+
margin-top: 6rem;
12+
${media.mobile(`
13+
margin-top: 3rem;
14+
`)}
15+
}
16+
`
17+
const TalkBlock = styled.div`
18+
display: flex;
19+
align-items: flex-start;
20+
flex-direction: row;
21+
`
22+
const PersonBlock = styled.div`
23+
flex: 1;
24+
margin-left: 2rem;
25+
`
26+
const Speaker = styled(Heading3)`
27+
font-size: 1.6rem;
28+
font-weight: bold;
29+
`
30+
const Title = styled.div`
31+
font-size: 1.2rem;
32+
font-weight: bold;
33+
`
34+
const Intro = styled.div`
35+
margin-top: 1.4rem;
36+
`
37+
38+
const SpeakerProfile = styled.div`
39+
width: 15rem;
40+
height: 15rem;
41+
background-image: url(${(props) => props.image});
42+
background-size: cover;
43+
background-position: center;
44+
border-radius: 50%;
45+
`
46+
47+
const KeynoteListItem = (props: { item: ITalkItem }) => {
48+
return (
49+
<ListItem>
50+
<Link href={`/program/talks/${props.item.id}`}>
51+
<a>
52+
<TalkBlock>
53+
<SpeakerProfile
54+
image={
55+
props.item.speaker_profile_img ??
56+
DEFAULT_PROFILE_PATH
57+
}
58+
/>
59+
<PersonBlock>
60+
<Speaker useGradient={true}>
61+
{props.item.user_name}
62+
</Speaker>
63+
<Title>{props.item.title}</Title>
64+
<Intro>{props.item.introduction}</Intro>
65+
</PersonBlock>
66+
</TalkBlock>
67+
</a>
68+
</Link>
69+
</ListItem>
70+
)
71+
}
72+
73+
export default KeynoteListItem

frontend/data/constants/resources.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const Resources = {
2020
'https://live.staticflickr.com/3912/14958407280_c7e9e6717e_z.jpg'
2121
},
2222
pyconkrFacebook: 'https://www.facebook.com/pyconkorea',
23-
pyconkrTwitter: 'https://twitter.com/PyConKR'
23+
pyconkrTwitter: 'https://twitter.com/PyConKR',
24+
KEYNOTE_CATEGORY: '키노트 (Keynote)'
2425
}
2526

2627
export default Resources

frontend/pages/program/keynote.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,50 @@ import { useTranslation } from 'react-i18next'
44
import { PageName } from '../../data/enums/PageName'
55
import PageTitle from '../../components/core/PageTitle'
66
import { PageProps } from '../../interfaces/PageProps'
7+
import { GetServerSidePropsContext } from 'next'
8+
import { getTalkList } from '../api/program'
9+
import { ITalkList } from '../../interfaces/IProgram'
10+
import KeynoteListItem from '../../components/service/Program/KeynoteListItem'
711

8-
const Keynote: NextPage = (props: PageProps) => {
9-
const { t } = useTranslation()
12+
interface TalkListProps extends PageProps {
13+
data: ITalkList
14+
}
15+
16+
const Keynote: NextPage = (props: TalkListProps) => {
17+
const { pageName, data } = props
1018

19+
const keynoteList = data.list.filter(
20+
(item) => item.category === '키노트 (Keynote)'
21+
)
1122
return (
1223
<div>
13-
<PageTitle title={props.pageName} />
14-
{t('label:preparing')}
24+
<PageTitle title={pageName} />
25+
{keynoteList.map((item) => (
26+
<KeynoteListItem key={item.id} item={item} />
27+
))}
1528
</div>
1629
)
1730
}
1831

19-
export const getServerSideProps: GetServerSideProps = async () => {
20-
return {
21-
props: {
22-
title: PageName.Keynote
32+
export const getServerSideProps: GetServerSideProps = async (
33+
context: GetServerSidePropsContext
34+
) => {
35+
const { locale } = context
36+
try {
37+
const data = await getTalkList()
38+
39+
return {
40+
props: {
41+
title: PageName.Keynote,
42+
locale,
43+
data
44+
}
45+
}
46+
} catch (error) {
47+
if (error.notFound) {
48+
return {
49+
notFound: true
50+
}
2351
}
2452
}
2553
}

0 commit comments

Comments
 (0)