19 lines
593 B
TypeScript
19 lines
593 B
TypeScript
import { useColorMode } from '@chakra-ui/react'
|
|
import { ForgedBlock } from '@typebot.io/forge-repository/types'
|
|
import { useForgedBlock } from './hooks/useForgedBlock'
|
|
|
|
export const ForgedBlockIcon = ({
|
|
type,
|
|
mt,
|
|
}: {
|
|
type: ForgedBlock['type']
|
|
mt?: string
|
|
}): JSX.Element => {
|
|
const { colorMode } = useColorMode()
|
|
const { blockDef } = useForgedBlock(type)
|
|
if (!blockDef) return <></>
|
|
if (colorMode === 'dark' && blockDef.DarkLogo)
|
|
return <blockDef.DarkLogo width="1rem" style={{ marginTop: mt }} />
|
|
return <blockDef.LightLogo width="1rem" style={{ marginTop: mt }} />
|
|
}
|