diff --git a/apps/client/src/menus/custom-items/ColorPickerMenuItem.css b/apps/client/src/menus/custom-items/ColorPickerMenuItem.css new file mode 100644 index 000000000..205ac9a29 --- /dev/null +++ b/apps/client/src/menus/custom-items/ColorPickerMenuItem.css @@ -0,0 +1,15 @@ +.color-picker-menu-item { + display: flex; + gap: 10px; +} + +.color-picker-menu-item > .color-cell { + width: 16px; + height: 16px; + border-radius: 4px; + background: transparent; +} + +.color-picker-menu-item > .color-cell.selected { + outline: 2px solid royalblue; +} \ No newline at end of file diff --git a/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsx b/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsx index 882881063..d9b9a3d41 100644 --- a/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsx +++ b/apps/client/src/menus/custom-items/ColorPickerMenuItem.tsx @@ -1,9 +1,38 @@ -import FNote from "../../entities/fnote" +import "./ColorPickerMenuItem.css"; +import { useState } from "preact/hooks"; +import attributes from "../../services/attributes"; +import FNote from "../../entities/fnote"; + +const COLORS = ["blue", "green", "cyan", "red", "magenta", "brown", "yellow", ""]; export interface ColorPickerMenuItemProps { note: FNote | null; } export default function ColorPickerMenuItem(props: ColorPickerMenuItemProps) { - return Color Picker + const {note} = props; + if (!note) return null; + + const [currentColor, setCurrentColor] = useState(note.getLabel("color")?.value ?? ""); + + const onColorCellClicked = (color: string) => { + attributes.setLabel(note.noteId, "color", color); + setCurrentColor(color); + } + + return