widgets are bound to container
figured out how to set bounds so widgets don't go off screen!
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
import { useSlotRecipe, chakra } from "@chakra-ui/react"
|
||||
|
||||
export default function Widget({ title }) {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className="widget-handle"
|
||||
style={{ padding: '4px', cursor: 'move', background: '#ddd' }}
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
<div style={{ padding: '8px' }}>
|
||||
This is the widget content - drag or resize me!
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
const recipe = useSlotRecipe({ key: "widget" });
|
||||
const styles = recipe();
|
||||
|
||||
return (
|
||||
<chakra.div css={styles.root}>
|
||||
<chakra.div css={styles.header}
|
||||
className="widget-handle"
|
||||
// style={{ padding: '4px', cursor: 'move', background: '#ddd' }}
|
||||
>
|
||||
{title}
|
||||
</chakra.div>
|
||||
<chakra.div css={styles.canvas}>
|
||||
This is the widget content - drag or resize me!
|
||||
</chakra.div>
|
||||
</chakra.div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user