mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
40 lines
795 B
TypeScript
40 lines
795 B
TypeScript
import { ImageResponse } from 'next/og'
|
|
|
|
export async function generateImageMetadata({ params }) {
|
|
return [
|
|
{
|
|
contentType: 'image/png',
|
|
size: { width: 48, height: 48 },
|
|
id: 'small',
|
|
},
|
|
{
|
|
contentType: 'image/png',
|
|
size: { width: 72, height: 72 },
|
|
id: 'medium',
|
|
},
|
|
]
|
|
}
|
|
|
|
export default async function icon({ params, id }) {
|
|
const { size } = await params
|
|
const iconId = await id
|
|
return new ImageResponse(
|
|
(
|
|
<div
|
|
style={{
|
|
width: '100%',
|
|
height: '100%',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
fontSize: 88,
|
|
background: '#fff',
|
|
color: '#000',
|
|
}}
|
|
>
|
|
Icon {size} {iconId}
|
|
</div>
|
|
)
|
|
)
|
|
}
|