personal-website/components/Callout.tsx
Filipe Medeiros 9a9638237f
feat: initial commit
Signed-off-by: Filipe Medeiros <hello@filipesm.eu>
2023-12-03 12:25:52 +01:00

33 lines
800 B
TypeScript

import { type CalloutBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'
import Image from 'next/image'
import { type FC, type PropsWithChildren } from 'react'
export interface Props {
icon: CalloutBlockObjectResponse['callout']['icon']
}
export const CalloutIcon: FC<PropsWithChildren<Props>> = ({ icon }) => {
return (
icon &&
(icon.type === 'emoji' ? (
<span>{icon.emoji}</span>
) : (
<Image
alt=""
className="h-6 w-6"
src={icon.type === 'file' ? icon.file.url : icon.external.url}
width={24}
height={24}
/>
))
)
}
const Callout: FC<PropsWithChildren> = ({ children }) => {
return (
<div className="flex rounded dark:bg-white dark:text-black">{children}</div>
)
}
export default Callout