MCPcopy
hub / github.com/premieroctet/openchakra / AlertPreview

Function AlertPreview

src/components/editor/previews/AlertPreview.tsx:7–31  ·  view source on GitHub ↗
({ component })

Source from the content-addressed store, hash-verified

5import { Alert, Box } from '@chakra-ui/react'
6
7const AlertPreview: React.FC<IPreviewProps> = ({ component }) => {
8 const acceptedTypes = [
9 'AlertIcon',
10 'AlertTitle',
11 'AlertDescription',
12 ] as ComponentType[]
13 const { props, ref } = useInteractive(component, false)
14 const { drop, isOver } = useDropComponent(component.id, acceptedTypes)
15
16 let boxProps: any = {}
17
18 if (isOver) {
19 props.bg = 'teal.50'
20 }
21
22 return (
23 <Box ref={drop(ref)} {...boxProps}>
24 <Alert {...props}>
25 {component.children.map((key: string) => (
26 <ComponentPreview key={key} componentName={key} />
27 ))}
28 </Alert>
29 </Box>
30 )
31}
32
33export default AlertPreview

Callers

nothing calls this directly

Calls 2

useInteractiveFunction · 0.90
useDropComponentFunction · 0.90

Tested by

no test coverage detected