Skip to content

Commit 28dfbcb

Browse files
authored
Merge pull request #61 from pythonkr/add-cfp-page
기여하기 > CFP 페이지 생성
2 parents ae40336 + 6d41038 commit 28dfbcb

File tree

10 files changed

+196
-2
lines changed

10 files changed

+196
-2
lines changed

frontend/assets/styles/markdown.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ const MarkdownStyle = styled.div`
1818
h2 ~ h2 {
1919
margin: 3rem 0 1.2rem;
2020
}
21+
ol,
22+
ul {
23+
margin-left: 2rem;
24+
}
2125
ul,
2226
li {
23-
margin: 0.3rem 0.6rem;
2427
padding: 0;
28+
line-height: 1.6;
2529
}
2630
ol li {
2731
list-style: numeric;
@@ -63,6 +67,9 @@ const MarkdownStyle = styled.div`
6367
td {
6468
padding: 0.6rem;
6569
}
70+
p {
71+
margin-top: 1rem;
72+
}
6673
`
6774

6875
export default MarkdownStyle

frontend/assets/styles/theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const Theme = {
33
primary0: '#1F1A24',
44
primary1: '#62599C',
55
primary2: '#0070f3',
6+
violet0: '#4c0097', // TODO: temporary color
67
black: '#000000',
78
white: '#ffffff',
89
grey_f9: '#f9f9f9',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react'
2+
3+
const LinkRenderer = (props) => {
4+
return (
5+
<a href={props.href} target="_blank" rel="noreferrer">
6+
{props.children}
7+
</a>
8+
)
9+
}
10+
11+
export default LinkRenderer

frontend/data/enums/PageName.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export enum PageName {
44
Pyconkr2022 = 'Pyconkr2022',
55
PreviousPyconkr = 'PreviousPyconkr',
66
Contribute = 'Contribute',
7+
Cfp = 'Cfp',
8+
CfpGuide = 'CfpGuide',
79
Sponsor = 'Sponsor',
810
SponsorProspectus = 'SponsorProspectus',
911
SponsorJoin = 'SponsorJoin',

frontend/locales/en/pageTitle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export default {
66
[PageName.Pyconkr2022]: 'Pycon Korea 2022',
77
[PageName.PreviousPyconkr]: 'Previous PyCon Korea',
88
[PageName.Contribute]: 'Contribution',
9+
[PageName.Cfp]: 'Call for Proposal',
10+
[PageName.CfpGuide]: 'How to Submit a Proposal',
911
[PageName.Sponsor]: 'Sponsor',
1012
[PageName.SponsorProspectus]: 'Prospectus',
1113
[PageName.SponsorJoin]: 'Join as Sponsor',

frontend/locales/ko/pageTitle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export default {
66
[PageName.Pyconkr2022]: '파이콘 한국 2022',
77
[PageName.PreviousPyconkr]: '지난 파이콘 한국',
88
[PageName.Contribute]: '기여하기',
9+
[PageName.Cfp]: '발표 제안하기',
10+
[PageName.CfpGuide]: '발표안 작성 가이드',
911
[PageName.Sponsor]: '후원하기',
1012
[PageName.SponsorProspectus]: '후원사 안내',
1113
[PageName.SponsorJoin]: '후원사로 참여하기',

frontend/pages/api/contribute.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import axios from 'axios'
2+
import { IContents } from '../../interfaces/IContents'
3+
import { IApiContents } from '../../interfaces/api/IApiContents'
4+
5+
export const getCfp = async (): Promise<IContents> => {
6+
const response = await axios.get(
7+
`https://api.2022.pycon.kr/api/content/cfp`
8+
)
9+
const data: IApiContents = response.data
10+
11+
return {
12+
content: {
13+
ko: data.content,
14+
en: data.eng_content
15+
}
16+
}
17+
}
18+
19+
export const getCfpGuide = async (): Promise<IContents> => {
20+
const response = await axios.get(
21+
`https://api.2022.pycon.kr/api/content/cfp-guide`
22+
)
23+
const data: IApiContents = response.data
24+
25+
return {
26+
content: {
27+
ko: data.content,
28+
en: data.eng_content
29+
}
30+
}
31+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React from 'react'
2+
import type { NextPage, GetServerSideProps } from 'next'
3+
import { PageName } from '../../../data/enums/PageName'
4+
import { SponsorPage } from '../../../interfaces/PageProps'
5+
import { GetServerSidePropsContext } from 'next'
6+
import { getCfpGuide } from '../../api/contribute'
7+
import ReactMarkdown from 'react-markdown'
8+
import HeadingComponents from '../../../components/core/MarkdownHeadings'
9+
import MarkdownStyle from '../../../assets/styles/markdown'
10+
import PageTitle from '../../../components/core/PageTitle'
11+
import remarkGfm from 'remark-gfm'
12+
import styled from 'styled-components'
13+
14+
interface SponsorSponsorFaqPage extends SponsorPage {
15+
locale: string
16+
}
17+
18+
const CfpGuideStyle = styled.div`
19+
ol {
20+
margin-top: 1.4rem;
21+
}
22+
a {
23+
display: block;
24+
}
25+
`
26+
27+
const SponsorFaq: NextPage = (props: SponsorSponsorFaqPage) => {
28+
return (
29+
<div>
30+
<PageTitle title={props.pageName} />
31+
<MarkdownStyle>
32+
<CfpGuideStyle>
33+
<ReactMarkdown
34+
components={HeadingComponents}
35+
remarkPlugins={[remarkGfm]}
36+
>
37+
{props.content[props.locale]}
38+
</ReactMarkdown>
39+
</CfpGuideStyle>
40+
</MarkdownStyle>
41+
</div>
42+
)
43+
}
44+
45+
export const getServerSideProps: GetServerSideProps = async (
46+
context: GetServerSidePropsContext
47+
) => {
48+
const { locale } = context
49+
const content = await getCfpGuide()
50+
51+
return {
52+
props: {
53+
title: PageName.CfpGuide,
54+
locale,
55+
...content
56+
}
57+
}
58+
}
59+
60+
export default SponsorFaq
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import React from 'react'
2+
import type { NextPage, GetServerSideProps } from 'next'
3+
import { PageName } from '../../../data/enums/PageName'
4+
import { SponsorPage } from '../../../interfaces/PageProps'
5+
import { GetServerSidePropsContext } from 'next'
6+
import { getCfp } from '../../api/contribute'
7+
import ReactMarkdown from 'react-markdown'
8+
import HeadingComponents from '../../../components/core/MarkdownHeadings'
9+
import MarkdownStyle from '../../../assets/styles/markdown'
10+
import PageTitle from '../../../components/core/PageTitle'
11+
import remarkGfm from 'remark-gfm'
12+
import styled from 'styled-components'
13+
14+
interface SponsorSponsorFaqPage extends SponsorPage {
15+
locale: string
16+
}
17+
18+
const CfpIndexStyle = styled.div`
19+
ol {
20+
margin-top: 1.4rem;
21+
}
22+
blockquote + p {
23+
a {
24+
display: inline-block;
25+
padding: 0.9rem 1.4rem;
26+
background-color: ${(props) => props.theme.colors.violet0};
27+
border-radius: 8px;
28+
text-decoration: none;
29+
font-weight: bold;
30+
color: ${(props) => props.theme.colors.white};
31+
}
32+
}
33+
`
34+
35+
const CfpIndex: NextPage = (props: SponsorSponsorFaqPage) => {
36+
return (
37+
<div>
38+
<PageTitle title={props.pageName} />
39+
<MarkdownStyle>
40+
<CfpIndexStyle>
41+
<ReactMarkdown
42+
components={HeadingComponents}
43+
remarkPlugins={[remarkGfm]}
44+
>
45+
{props.content[props.locale]}
46+
</ReactMarkdown>
47+
</CfpIndexStyle>
48+
</MarkdownStyle>
49+
</div>
50+
)
51+
}
52+
53+
export const getServerSideProps: GetServerSideProps = async (
54+
context: GetServerSidePropsContext
55+
) => {
56+
const { locale } = context
57+
const content = await getCfp()
58+
59+
return {
60+
props: {
61+
title: PageName.Cfp,
62+
locale,
63+
...content
64+
}
65+
}
66+
}
67+
68+
export default CfpIndex

frontend/routes/routes.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ export const routes: RouteType[] = [
2727
},
2828
{
2929
path: '/contribute',
30-
name: PageName.Contribute
30+
name: PageName.Contribute,
31+
subMenu: [
32+
{
33+
path: '/contribute/cfp',
34+
name: PageName.Cfp
35+
},
36+
{
37+
path: '/contribute/cfp/guide',
38+
name: PageName.CfpGuide
39+
}
40+
]
3141
},
3242
{
3343
path: '/sponsor',

0 commit comments

Comments
 (0)