person page updated + ts
This commit is contained in:
1 parent
38f58b0b1d
commit
180c9f34c5
1 file changed
+26
-8
@@ -1,34 +1,52 @@
|
||||
import React from 'react'
|
||||
import Head from 'next/head'
|
||||
import { App } from '../../src/components/App'
|
||||
import { Page } from '../../src/components/Page'
|
||||
import Article from '../../src/components/Article'
|
||||
import { Meta } from '../../src/components/Meta'
|
||||
import menuModel from '../../src/models/menu'
|
||||
import { buildMenu } from '../../src/lib/menu'
|
||||
import { meta } from '../../src/lib/meta'
|
||||
import { createApiUrl, requestGet, wrapInitialProps } from '../../src/next-lib'
|
||||
import { NextPage } from 'next'
|
||||
import { IMeta } from '../../src/types'
|
||||
import Html from '../../src/components/Html'
|
||||
|
||||
const Index = (props) => (
|
||||
interface IProps {
|
||||
pageUrl: string
|
||||
title: string
|
||||
meta: IMeta
|
||||
person: any
|
||||
}
|
||||
|
||||
const Index: NextPage<IProps> = props => (
|
||||
<App
|
||||
menu={buildMenu(props.pageUrl, menuModel)}
|
||||
showAuthor={true}
|
||||
menuPadding={true}
|
||||
layout={'wide'}
|
||||
layout={'thin'}
|
||||
>
|
||||
<Head>
|
||||
<title>{props.title}</title>
|
||||
<Meta meta={props.meta} />
|
||||
</Head>
|
||||
<Page shareable={true}>
|
||||
{props.person.post}
|
||||
</Page>
|
||||
|
||||
<Article
|
||||
title={''}
|
||||
tags={[]}
|
||||
date={null}
|
||||
shareable={true}
|
||||
>
|
||||
<Html
|
||||
html={props.person.post}
|
||||
/>
|
||||
</Article>
|
||||
</App>
|
||||
)
|
||||
|
||||
Index.getInitialProps = wrapInitialProps(async (ctx) => {
|
||||
const pageUrl = '/collective'
|
||||
const id = ctx.query.person
|
||||
const person = await requestGet(createApiUrl(ctx.req, `/api/persons/${id}`), {})
|
||||
const person: any = await requestGet(createApiUrl(ctx.req, `/api/persons/${id}`), {})
|
||||
const name = person.name || []
|
||||
const title = name.join(' ')
|
||||
const image = person.preview ? person.preview.artifacts.fb : {}
|
||||
@@ -46,4 +64,4 @@ Index.getInitialProps = wrapInitialProps(async (ctx) => {
|
||||
}
|
||||
})
|
||||
|
||||
export default Index
|
||||
export default Index
|
||||
Reference in new issue
Block a user