Files
Khalid Abdi ea2ecb572c Add Notes page: Tiptap rich-text editor backed by the notes API
- lib/notes.ts: list/get/create/update/delete via the API client.
- New /notes route + nav item (and shared lib/nav.ts entry, i18n key) so it
  shows in the sidebar and command palette.
- components/notes/notes-view.tsx: a note list + "New note", with save/delete
  and toasts.
- components/notes/notes-editor.tsx: a Word-like COSS Toolbar driving Tiptap
  (StarterKit + Placeholder) — bold/italic/underline, H1–H2, bullet/numbered
  lists, undo/redo — plus a title field and Save. Installed @coss/toolbar and
  @coss/toggle-group and the Tiptap packages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 19:48:51 +03:00

92 lines
2.1 KiB
TypeScript

"use client";
import { Toolbar as ToolbarPrimitive } from "@base-ui/react/toolbar";
import type React from "react";
import { cn } from "@/lib/utils";
export function Toolbar({
className,
...props
}: ToolbarPrimitive.Root.Props): React.ReactElement {
return (
<ToolbarPrimitive.Root
className={cn(
"relative flex gap-2 rounded-xl border bg-card not-dark:bg-clip-padding p-1 text-card-foreground",
className,
)}
data-slot="toolbar"
{...props}
/>
);
}
export function ToolbarButton({
className,
...props
}: ToolbarPrimitive.Button.Props): React.ReactElement {
return (
<ToolbarPrimitive.Button
className={cn(className)}
data-slot="toolbar-button"
{...props}
/>
);
}
export function ToolbarLink({
className,
...props
}: ToolbarPrimitive.Link.Props): React.ReactElement {
return (
<ToolbarPrimitive.Link
className={cn(className)}
data-slot="toolbar-link"
{...props}
/>
);
}
export function ToolbarInput({
className,
...props
}: ToolbarPrimitive.Input.Props): React.ReactElement {
return (
<ToolbarPrimitive.Input
className={cn(className)}
data-slot="toolbar-input"
{...props}
/>
);
}
export function ToolbarGroup({
className,
...props
}: ToolbarPrimitive.Group.Props): React.ReactElement {
return (
<ToolbarPrimitive.Group
className={cn("flex items-center gap-1", className)}
data-slot="toolbar-group"
{...props}
/>
);
}
export function ToolbarSeparator({
className,
...props
}: ToolbarPrimitive.Separator.Props): React.ReactElement {
return (
<ToolbarPrimitive.Separator
className={cn(
"shrink-0 bg-border data-[orientation=horizontal]:my-0.5 data-[orientation=vertical]:my-1.5 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch",
className,
)}
data-slot="toolbar-separator"
{...props}
/>
);
}
export { ToolbarPrimitive };