MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / ToggleGroup

Function ToggleGroup

packages/app-core/src/components/EditorPane.tsx:3790–3821  ·  view source on GitHub ↗
({
  mode,
  onChange
}: {
  mode: PaneMode
  onChange: (m: PaneMode) => void
})

Source from the content-addressed store, hash-verified

3788}
3789
3790function ToggleGroup({
3791 mode,
3792 onChange
3793}: {
3794 mode: PaneMode
3795 onChange: (m: PaneMode) => void
3796}): JSX.Element {
3797 const keymapOverrides = useStore((s) => s.keymapOverrides)
3798 return (
3799 <div className="flex items-center gap-1 rounded-md bg-paper-200/70 p-0.5 text-xs">
3800 {MODE_OPTIONS.map((option) => {
3801 const shortcut = getKeymapDisplay(keymapOverrides, option.keymapId)
3802 return (
3803 <button
3804 key={option.mode}
3805 onClick={() => onChange(option.mode)}
3806 title={`${option.tooltipLabel} (${shortcut})`}
3807 aria-label={`${option.tooltipLabel} (${shortcut})`}
3808 className={[
3809 'rounded px-2 py-1 transition-colors',
3810 mode === option.mode
3811 ? 'bg-paper-50 text-ink-900 shadow-sm'
3812 : 'text-ink-500 hover:text-ink-800'
3813 ].join(' ')}
3814 >
3815 {option.label}
3816 </button>
3817 )
3818 })}
3819 </div>
3820 )
3821}
3822
3823const INVALID_FILENAME_CHARS = /[/\\:*?"<>|#^\[\]]/
3824

Callers

nothing calls this directly

Calls 2

getKeymapDisplayFunction · 0.90
onChangeFunction · 0.70

Tested by

no test coverage detected