Files
site-builder/craft/src/components/basic/Divider.tsx
T
shadowdaoandClaude Opus 4.8 65a10a1ef9 refactor(builder): remove dead component settings UI
Each component defined a .craft.related.settings panel that was never
rendered -- the right panel renders only GuidedStyles (per-type
*StylePanel components), never .related.settings. Removed all dead
settings components across every component, their settings-only helpers
(including the dead uploadToWhp/showBrowser/handleBrowse asset-browse
blocks in Logo/Navbar/VideoBlock/FeaturesGrid, and CtasEditor in
_cta-helpers), and dropped the now-empty related keys. Render output,
.craft props/rules, and toHtml statics are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 13:16:53 -07:00

64 lines
1.4 KiB
TypeScript

import React, { CSSProperties } from 'react';
import { useNode, UserComponent } from '@craftjs/core';
import { cssPropsToString } from '../../utils/style-helpers';
interface DividerProps {
color?: string;
thickness?: string;
style?: CSSProperties;
}
export const Divider: UserComponent<DividerProps> = ({
color = '#e4e4e7',
thickness = '1px',
style = {},
}) => {
const {
connectors: { connect, drag },
selected,
} = useNode((node) => ({
selected: node.events.selected,
}));
return (
<hr
ref={(ref: HTMLHRElement | null): void => { if (ref) connect(drag(ref)); }}
style={{
border: 'none',
borderTop: `${thickness} solid ${color}`,
margin: '16px 0',
outline: selected ? '2px solid #3b82f6' : 'none',
...style,
}}
/>
);
};
/* ---------- Craft config ---------- */
Divider.craft = {
displayName: 'Divider',
props: {
color: '#e4e4e7',
thickness: '1px',
style: {},
},
rules: {
canDrag: () => true,
canMoveIn: () => false,
canMoveOut: () => true,
},
};
/* ---------- HTML export ---------- */
(Divider as any).toHtml = (props: DividerProps, _childrenHtml: string) => {
const styleStr = cssPropsToString({
border: 'none',
borderTop: `${props.thickness || '1px'} solid ${props.color || '#e4e4e7'}`,
margin: '16px 0',
...props.style,
});
return { html: `<hr${styleStr ? ` style="${styleStr}"` : ''} />` };
};