@objectifthunes/whiteboard
WHITEBOARD SAAS

SectionPanel

One draggable board holding a static grid of cards. Gaps and paddings equal the canvas grid unit, so sections span whole plus signs.


PREVIEW
SOURCE
import { SectionPanel, sectionPanelWidth } from '@objectifthunes/whiteboard'

<SectionPanel title="Videos" defaultPosition={{ x: 0, y: 0 }} cols={4} cardW={260}>
  {videos.map(v => <VideoCard key={v.id} video={v} />)}
</SectionPanel>

// Place the next thing one grid-gap to the right of the section:
const nextX = sectionPanelWidth(4, 260) + 80
SOURCE
interface SectionPanelProps {
  title: ReactNode
  defaultPosition: { x: number; y: number }
  cols: number
  cardW: number            // keep it a multiple of WHITEBOARD_GRID (20)
  headerActions?: ReactNode
  className?: string
  loading?: boolean        // skeleton cards under a blurred overlay
  loadingCards?: number    // default: one row (cols)
  loadingMessage?: string  // default 'Loading…'
}

sectionPanelWidth(cols, cardW)
// = cols * cardW + (cols + 1) * WHITEBOARD_GRID
NOTES

The section is the draggable unit — grab its header; the cards inside are static grid items, so buttons, videos and inputs in them behave normally.

Body padding and card gaps both equal the canvas grid unit (20 world units), and with cardWa multiple of 20 the section's outer width is always a whole number of background plus signs — internal rhythm and canvas rhythm never drift.