Rename to ogCardProps

This commit is contained in:
Austin Chen 2022-01-10 01:50:16 -05:00
parent 2bf651993b
commit e14970dc70
2 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
import Head from 'next/head' import Head from 'next/head'
export type OpenGraphProps = { export type OgCardProps = {
question: string question: string
probability: string probability: string
metadata: string metadata: string
@ -9,7 +9,7 @@ export type OpenGraphProps = {
creatorAvatarUrl: string creatorAvatarUrl: string
} }
function buildCardUrl(props: OpenGraphProps) { function buildCardUrl(props: OgCardProps) {
// URL encode each of the props, then add them as query params // URL encode each of the props, then add them as query params
return ( return (
`https://manifold-og-image.vercel.app/m.png` + `https://manifold-og-image.vercel.app/m.png` +
@ -27,9 +27,9 @@ export function SEO(props: {
description: string description: string
url?: string url?: string
children?: any[] children?: any[]
openGraph?: OpenGraphProps ogCardProps?: OgCardProps
}) { }) {
const { title, description, url, children, openGraph } = props const { title, description, url, children, ogCardProps } = props
return ( return (
<Head> <Head>
@ -57,17 +57,17 @@ export function SEO(props: {
/> />
)} )}
{openGraph && ( {ogCardProps && (
<> <>
<meta <meta
property="og:image" property="og:image"
content={buildCardUrl(openGraph)} content={buildCardUrl(ogCardProps)}
key="image1" key="image1"
/> />
<meta name="twitter:card" content="summary_large_image" key="card" /> <meta name="twitter:card" content="summary_large_image" key="card" />
<meta <meta
name="twitter:image" name="twitter:image"
content={buildCardUrl(openGraph)} content={buildCardUrl(ogCardProps)}
key="image2" key="image2"
/> />
</> </>

View File

@ -64,7 +64,7 @@ export default function ContractPage(props: {
? `Resolved ${resolution}. ${contract.description}` ? `Resolved ${resolution}. ${contract.description}`
: `${probPercent} chance. ${contract.description}` : `${probPercent} chance. ${contract.description}`
const openGraphProps = { const ogCardProps = {
question, question,
probability: probPercent, probability: probPercent,
metadata: contractTextDetails(contract), metadata: contractTextDetails(contract),
@ -80,7 +80,7 @@ export default function ContractPage(props: {
title={question} title={question}
description={description} description={description}
url={`/${props.username}/${props.slug}`} url={`/${props.username}/${props.slug}`}
openGraph={openGraphProps} ogCardProps={ogCardProps}
/> />
<Col className="w-full md:flex-row justify-between mt-6"> <Col className="w-full md:flex-row justify-between mt-6">