import React, { CSSProperties } from 'react'; import { useNode, UserComponent } from '@craftjs/core'; import { cssPropsToString } from '../../utils/style-helpers'; interface CTASectionProps { heading?: string; description?: string; buttonText?: string; buttonHref?: string; gradient?: string; style?: CSSProperties; } const defaultGradient = 'linear-gradient(135deg, #2563eb 0%, #7c3aed 100%)'; export const CTASection: UserComponent = ({ heading = 'Ready to Get Started?', description = 'Join thousands of satisfied users and start building your dream website today.', buttonText = 'Start Free Trial', buttonHref = '#', gradient = defaultGradient, style = {}, }) => { const { connectors: { connect, drag }, selected, } = useNode((node) => ({ selected: node.events.selected, })); return (
{ if (ref) connect(drag(ref)); }} style={{ background: gradient, padding: '80px 20px', textAlign: 'center', outline: selected ? '2px solid #3b82f6' : 'none', ...style, }} >

{heading}

{description}

e.preventDefault()} style={{ display: 'inline-block', padding: '14px 36px', backgroundColor: '#ffffff', color: '#18181b', textDecoration: 'none', borderRadius: '8px', fontWeight: '600', fontSize: '16px', }} > {buttonText}
); }; /* ---------- Settings panel ---------- */ const CTASectionSettings: React.FC = () => { const { actions: { setProp }, props } = useNode((node) => ({ props: node.data.props as CTASectionProps, })); const gradientPresets = [ { label: 'Blue-Purple', value: 'linear-gradient(135deg, #2563eb 0%, #7c3aed 100%)' }, { label: 'Purple', value: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }, { label: 'Teal', value: 'linear-gradient(135deg, #0d9488 0%, #0f766e 100%)' }, { label: 'Sunset', value: 'linear-gradient(135deg, #f97316 0%, #ec4899 100%)' }, { label: 'Dark', value: 'linear-gradient(135deg, #1e293b 0%, #0f172a 100%)' }, { label: 'Ocean', value: 'linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%)' }, ]; return (
setProp((p: CTASectionProps) => { p.heading = e.target.value; })} style={{ width: '100%', padding: '4px 8px', background: '#27272a', color: '#e4e4e7', border: '1px solid #3f3f46', borderRadius: 4, fontSize: 12 }} />