From 2a6359e2478b67a0bf866835b9ab7d1294789867 Mon Sep 17 00:00:00 2001 From: CC Worker Date: Sun, 31 May 2026 21:46:33 +0000 Subject: [PATCH] feat: extract static shape styles to CSS classes in CCBaseShapeUtil --- src/utils/tldraw/cc-base/CCBaseShapeUtil.tsx | 63 ++++--------------- .../ui-overrides/components/shared/panel.css | 60 ++++++++++++++++++ 2 files changed, 72 insertions(+), 51 deletions(-) diff --git a/src/utils/tldraw/cc-base/CCBaseShapeUtil.tsx b/src/utils/tldraw/cc-base/CCBaseShapeUtil.tsx index 24a2e03..491c5b6 100644 --- a/src/utils/tldraw/cc-base/CCBaseShapeUtil.tsx +++ b/src/utils/tldraw/cc-base/CCBaseShapeUtil.tsx @@ -40,44 +40,32 @@ export abstract class CCBaseShapeUtil extends BaseBoxShap component(shape: T) { const { - props: { w, h, isLocked }, + props: { w, h, isLocked, headerColor }, } = shape const toolbarItems = this.getToolbarItems(shape) return ( {/* Header */}
- {shape.props.title} -
+ {shape.props.title} +
{toolbarItems.map((item) => (
{/* Content */} -
{this.renderContent(shape)}
diff --git a/src/utils/tldraw/ui-overrides/components/shared/panel.css b/src/utils/tldraw/ui-overrides/components/shared/panel.css index 920ae0e..b341777 100644 --- a/src/utils/tldraw/ui-overrides/components/shared/panel.css +++ b/src/utils/tldraw/ui-overrides/components/shared/panel.css @@ -268,4 +268,64 @@ text-align: center; color: var(--color-text-2); padding: 16px; +} + +/* CC Base Shape Styles */ +.cc-shape-container { + overflow: hidden; + position: relative; + border-radius: 4px; + box-shadow: 0 2px 4px var(--color-muted-1); +} + +.cc-shape-header { + display: flex; + justify-content: space-between; + align-items: center; + cursor: not-allowed; + position: relative; + z-index: 1; + background: var(--shape-header-color, var(--color-muted)); + padding: 8px; + height: 32px; +} + +.cc-shape-header .shape-title { + color: white; + font-weight: bold; +} + +.cc-shape-toolbar { + display: flex; + gap: 4px; + align-items: center; +} + +.cc-shape-toolbar button { + background: transparent; + border: none; + padding: 4px; + cursor: pointer; + color: white; + opacity: 0.7; + display: flex; + align-items: center; + justify-content: center; + font-size: 16px; + width: 24px; + height: 24px; + z-index: 100; + user-select: none; + position: relative; + touch-action: none; +} + +.cc-shape-content { + position: absolute; + top: 32px; + left: 0; + right: 0; + bottom: 0; + overflow: auto; + padding: 8px; } \ No newline at end of file