|
| 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 |
0 commit comments