|
1 | 1 | import { GetServerSideProps, GetServerSidePropsContext, NextPage } from 'next' |
2 | 2 | import React from 'react' |
3 | 3 | import { LocalePage } from '../../../interfaces/PageProps' |
4 | | -import { ITalkItem } from '../../../interfaces/IProgram' |
| 4 | +import { ISpeaker, ITalkItem } from '../../../interfaces/IProgram' |
5 | 5 | import { getTalkById } from '../../api/program' |
6 | 6 | import PageTitle from '../../../components/core/PageTitle' |
| 7 | +import { useTranslation } from 'react-i18next' |
| 8 | +import Speaker from '../../../components/service/Program/Speaker' |
| 9 | +import { DEFAULT_PROFILE_PATH } from '../../../data/constants/config' |
| 10 | +import styled from 'styled-components' |
| 11 | +import { media } from '../../../assets/styles/mixin' |
7 | 12 |
|
8 | 13 | interface TalkListDetailProps extends LocalePage<ITalkItem> { |
9 | 14 | locale: string |
10 | 15 | } |
11 | 16 |
|
| 17 | +const SpeakerContainer = styled.div` |
| 18 | + margin-top: 4rem; |
| 19 | + ${media.mobile(` |
| 20 | + margin-top: 6rem; |
| 21 | + `)} |
| 22 | +` |
| 23 | +const Description = styled.div` |
| 24 | + margin-top: 1rem; |
| 25 | +` |
| 26 | + |
| 27 | + |
12 | 28 | const TalkListDetail: NextPage = (props: TalkListDetailProps) => { |
13 | | - return <PageTitle title={props.ko.title} /> |
| 29 | + const { t } = useTranslation() |
| 30 | + |
| 31 | + const item: ITalkItem = props[props.locale] |
| 32 | + const speaker: ISpeaker = { |
| 33 | + imageUrl: item.speaker_profile_img ?? DEFAULT_PROFILE_PATH, |
| 34 | + name: item.user_name, |
| 35 | + introduction: item.introduction |
| 36 | + } |
| 37 | + |
| 38 | + return ( |
| 39 | + <> |
| 40 | + <PageTitle title={item.title} /> |
| 41 | + <div> |
| 42 | + {t('label:category')}: {item.category} |
| 43 | + </div> |
| 44 | + <div>{t('label:difficulty')}: {item.difficulty}</div> |
| 45 | + <div>{t('label:duration')}: {item.duration}</div> |
| 46 | + <div>{t('label:language')}: {item.language}</div> |
| 47 | + <Description>{item.desc}</Description> |
| 48 | + <SpeakerContainer> |
| 49 | + <Speaker item={speaker} /> |
| 50 | + </SpeakerContainer> |
| 51 | + </> |
| 52 | + ) |
14 | 53 | } |
15 | 54 |
|
16 | 55 | export const getServerSideProps: GetServerSideProps = async ( |
|
0 commit comments