person page updated + ts
This commit is contained in:
1 parent
38f58b0b1d
commit
180c9f34c5
1 file changed
+25
-7
@@ -1,34 +1,52 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import { App } from '../../src/components/App'
|
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 { Meta } from '../../src/components/Meta'
|
||||||
import menuModel from '../../src/models/menu'
|
import menuModel from '../../src/models/menu'
|
||||||
import { buildMenu } from '../../src/lib/menu'
|
import { buildMenu } from '../../src/lib/menu'
|
||||||
import { meta } from '../../src/lib/meta'
|
import { meta } from '../../src/lib/meta'
|
||||||
import { createApiUrl, requestGet, wrapInitialProps } from '../../src/next-lib'
|
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
|
<App
|
||||||
menu={buildMenu(props.pageUrl, menuModel)}
|
menu={buildMenu(props.pageUrl, menuModel)}
|
||||||
showAuthor={true}
|
showAuthor={true}
|
||||||
menuPadding={true}
|
menuPadding={true}
|
||||||
layout={'wide'}
|
layout={'thin'}
|
||||||
>
|
>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{props.title}</title>
|
<title>{props.title}</title>
|
||||||
<Meta meta={props.meta} />
|
<Meta meta={props.meta} />
|
||||||
</Head>
|
</Head>
|
||||||
<Page shareable={true}>
|
|
||||||
{props.person.post}
|
<Article
|
||||||
</Page>
|
title={''}
|
||||||
|
tags={[]}
|
||||||
|
date={null}
|
||||||
|
shareable={true}
|
||||||
|
>
|
||||||
|
<Html
|
||||||
|
html={props.person.post}
|
||||||
|
/>
|
||||||
|
</Article>
|
||||||
</App>
|
</App>
|
||||||
)
|
)
|
||||||
|
|
||||||
Index.getInitialProps = wrapInitialProps(async (ctx) => {
|
Index.getInitialProps = wrapInitialProps(async (ctx) => {
|
||||||
const pageUrl = '/collective'
|
const pageUrl = '/collective'
|
||||||
const id = ctx.query.person
|
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 name = person.name || []
|
||||||
const title = name.join(' ')
|
const title = name.join(' ')
|
||||||
const image = person.preview ? person.preview.artifacts.fb : {}
|
const image = person.preview ? person.preview.artifacts.fb : {}
|
||||||
Reference in new issue
Block a user