We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, CardImage, } from "../ui/card"; import { Element } from "@craftjs/core"; import { SettingsControl } from "../settings-control"; import { withNode } from "./connector"; import { NodeButton } from "./button"; interface NodeCardProps extends React.HTMLAttributes<HTMLDivElement> {} const draggable = true; const droppable = true; // Can drop items into to this component export const NodeCardHeader = withNode(CardHeader, { droppable, }); export const NodeCardTitle = withNode(CardTitle, { draggable, droppable, }); NodeCardTitle.craft = { ...NodeCardTitle.craft, related: { toolbar: SettingsControl, }, }; export const NodeCardDescription = withNode(CardDescription, { draggable, droppable, }); NodeCardDescription.craft = { ...NodeCardDescription.craft, related: { toolbar: SettingsControl, }, }; export const NodeCardContent = withNode(CardContent, { droppable, }); export const NodeCardFooter = withNode(CardFooter, { droppable, }); export const NodeCardContainer = withNode(Card, { draggable, droppable, }); export const NodeCardImage = withNode(CardImage, { droppable, draggable, }); NodeCardImage.craft = { ...NodeCardImage.craft, related: { toolbar: SettingsControl, }, }; export const NodeCard = ({ ...props }: NodeCardProps) => { return ( <NodeCardContainer {...props}> <Element canvas id='card-header' is={NodeCardHeader as typeof NodeCardHeader & string}> <NodeCardTitle>Card Title</NodeCardTitle> <NodeCardDescription>Card Description</NodeCardDescription> </Element> <Element canvas id='card-content' is={NodeCardContent as typeof NodeCardContent & string}> <NodeCardImage /> </Element> <Element canvas id='card-footer' is={NodeCardFooter as typeof NodeCardFooter & string}> <NodeButton>Footer button</NodeButton> </Element> </NodeCardContainer> ); }; NodeCard.craft = { ...NodeCard.craft, displayName: "Card", props: { className: "p-6 m-2", }, custom: { importPath: "@/components/card", }, related: { toolbar: SettingsControl, }, };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: