Files
portfolio/web/src/components/ContactCard/ContactCardCell/ContactCardCell.tsx
Ahmed Al-Taiar 62ce137bcb
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 11s
Add og metatags to public facing pages
2024-10-22 16:48:48 -04:00

65 lines
1.5 KiB
TypeScript

import type {
ContactCardPortrait,
ContactCardPortraitVariables,
} from 'types/graphql'
import { routes } from '@redwoodjs/router'
import {
type TypedDocumentNode,
type CellFailureProps,
type CellSuccessProps,
Metadata,
} from '@redwoodjs/web'
import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty'
import CellFailure from 'src/components/Cell/CellFailure/CellFailure'
import CellLoading from 'src/components/Cell/CellLoading/CellLoading'
import ContactCard from 'src/components/ContactCard/ContactCard/ContactCard'
export const QUERY: TypedDocumentNode<
ContactCardPortrait,
ContactCardPortraitVariables
> = gql`
query ContactCardPortrait {
portrait {
fileId
}
socials {
id
name
type
username
}
}
`
export const Loading = () => <CellLoading />
export const Empty = () => <CellEmpty />
export const Failure = ({ error }: CellFailureProps<ContactCardPortrait>) => (
<CellFailure error={error} />
)
export const Success = ({
portrait,
socials,
}: CellSuccessProps<ContactCardPortrait, ContactCardPortraitVariables>) => (
<>
<Metadata
title="Contact"
og={{
title: 'Contact',
type: 'website',
image: {
url: portrait.fileId,
type: 'image/webp',
alt: `${process.env.FIRST_NAME} ${process.env.LAST_NAME}`,
},
url: routes.contact(),
}}
/>
<ContactCard portraitUrl={portrait.fileId} socials={socials} />
</>
)