Skip to content

Commit 5d3781b

Browse files
committed
발표 목록 생성
1 parent 4aa2125 commit 5d3781b

File tree

11 files changed

+146
-46
lines changed

11 files changed

+146
-46
lines changed

frontend/assets/styles/typo.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@ const Heading2 = styled.h2`
1919
`
2020

2121
const Heading3 = styled.h3`
22-
font-size: 1.5rem;
22+
font-size: 1.6rem;
2323
line-height: 1.3;
24+
${(props) => {
25+
if (props.useGradient) {
26+
return `background: ${props.theme.gradient_violet};
27+
-webkit-background-clip: text;
28+
-webkit-text-fill-color: transparent;`
29+
}
30+
}}
2431
`
2532

2633
const Heading4 = styled.h4`
27-
font-size: 1.25rem;
28-
line-height: 1.3;
34+
font-size: 1.1rem;
35+
line-height: 1.4;
2936
`
3037

3138
const Paragraph = styled.p`

frontend/components/core/NavBarMobile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Container = styled.div`
3131
if (props.isTransparent) {
3232
return `background: transparent;`
3333
}
34-
return `background-image: ${props.theme.black_10};`
34+
return `background: ${props.theme.black_10};`
3535
}}
3636
`
3737

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from 'react'
2+
import { ICategoryListItem, ITalkList } from '../../../interfaces/IProgram'
3+
import styled from 'styled-components'
4+
import { Heading3 } from '../../../assets/styles/typo'
5+
import CategoryListItem from './CategoryListItem'
6+
7+
const CategoryBlock = styled.ul`
8+
& + & {
9+
margin-top: 4rem;
10+
}
11+
`
12+
13+
const CategoryList = (props: { list: ITalkList }) => {
14+
const categoryList: ICategoryListItem[] = []
15+
16+
props.list.list.forEach((talk) => {
17+
if (!categoryList.hasOwnProperty(talk.category)) {
18+
categoryList[talk.category] = { name: talk.category, talkList: [] }
19+
}
20+
categoryList[talk.category].talkList.push(talk)
21+
})
22+
23+
console.log(categoryList)
24+
return (
25+
<>
26+
{Object.keys(categoryList).map((key, index) => (
27+
<CategoryBlock key={`category-${index}`}>
28+
<li>
29+
<Heading3 useGradient={true}>
30+
{categoryList[key].name}
31+
</Heading3>
32+
<CategoryListItem list={categoryList[key].talkList} />
33+
</li>
34+
</CategoryBlock>
35+
))}
36+
</>
37+
)
38+
}
39+
40+
export default CategoryList
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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 { Heading4 } from '../../../assets/styles/typo'
6+
7+
const DEFAULT_PROFILE_PATH = '/images/pyconkr2022-profile.png'
8+
9+
const TalkList = styled.ul`
10+
margin-top: 1.5rem;
11+
`
12+
const TalkListItem = styled.li`
13+
& + & {
14+
margin-top: 2rem;
15+
${media.mobile(`
16+
margin-top: 1.5rem;
17+
`)}
18+
}
19+
`
20+
const TalkLink = styled.a`
21+
display: inline-block;
22+
`
23+
const TalkBlock = styled.div`
24+
display: flex;
25+
align-items: center;
26+
flex-direction: row;
27+
`
28+
const PersonBlock = styled.div`
29+
margin-left: 2rem;
30+
flex: 1;
31+
`
32+
const Speaker = styled.div`
33+
margin-top: 0.4rem;
34+
`
35+
const Title = styled(Heading4)`
36+
font-weight: bold;
37+
`
38+
const SpeakerProfile = styled.div`
39+
width: 6rem;
40+
height: 6rem;
41+
background-image: url(${(props) => props.image});
42+
background-size: cover;
43+
border-radius: 50%;
44+
`
45+
46+
const CategoryListItem = (props: { list: ITalkItem[] }) => {
47+
return (
48+
<TalkList>
49+
{props.list.map((talk, index) => (
50+
<TalkListItem key={talk.id}>
51+
<TalkLink href={`/program/talks/${talk.id}`}>
52+
<TalkBlock>
53+
<SpeakerProfile
54+
image={
55+
talk.speaker_profile_img ??
56+
DEFAULT_PROFILE_PATH
57+
}
58+
/>
59+
<PersonBlock>
60+
<Title>{talk.title}</Title>
61+
<Speaker>{talk.user_name}</Speaker>
62+
</PersonBlock>
63+
</TalkBlock>
64+
</TalkLink>
65+
</TalkListItem>
66+
))}
67+
</TalkList>
68+
)
69+
}
70+
71+
export default CategoryListItem

frontend/components/service/Program/TalkList.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

frontend/components/service/Program/TalkListItem.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

frontend/data/enums/Category.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export enum Category {}

frontend/interfaces/IProgram.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { IApiTalkItem } from './api/IApiPrograms'
22

33
export interface ITalkItem extends IApiTalkItem {}
44

5+
export interface ICategoryListItem {
6+
name: string
7+
talkList: ITalkItem[]
8+
}
9+
510
export interface ITalkList {
611
list: ITalkItem[]
712
}

frontend/pages/400.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react'
2+
import { NextPage } from 'next'
3+
import { useTranslation } from 'react-i18next'
4+
5+
const BadRequestPage: NextPage = () => {
6+
const { t } = useTranslation()
7+
8+
return <div>{t('error:serverError')}</div>
9+
}
10+
11+
export default BadRequestPage

frontend/pages/program/talks/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import type { NextPage, GetServerSideProps } from 'next'
33
import { PageName } from '../../../data/enums/PageName'
44
import PageTitle from '../../../components/core/PageTitle'
55
import { PageProps } from '../../../interfaces/PageProps'
6-
import TalkList from '../../../components/service/Program/TalkList'
76
import { GetServerSidePropsContext } from 'next'
87
import { getTalkList } from '../../api/program'
98
import { ITalkList } from '../../../interfaces/IProgram'
9+
import CategoryList from '../../../components/service/Program/CategoryList'
1010

1111
interface TalkListProps extends PageProps {
1212
data: ITalkList
@@ -17,7 +17,7 @@ const TalkListPage: NextPage = (props: TalkListProps) => {
1717
return (
1818
<div>
1919
<PageTitle title={pageName} />
20-
<TalkList list={data.list} />
20+
<CategoryList list={data} />
2121
</div>
2222
)
2323
}
@@ -37,8 +37,11 @@ export const getServerSideProps: GetServerSideProps = async (
3737
}
3838
}
3939
} catch (error) {
40-
return {
41-
notFound: true
40+
// TODO: Add error interface
41+
if (error.notFound) {
42+
return {
43+
notFound: true
44+
}
4245
}
4346
}
4447
}

0 commit comments

Comments
 (0)