import React, { useRef, useState } from 'react'; import { EmojiPickerModal } from '../features/workspace/EmojiPickerModal'; interface EmojiIconButtonProps { value: string; onChange: (emoji: string) => void; // Default icon; removing the icon in the picker goes back to it fallback: string; } // Icon field of the create dialogs (note, task list, list): the emoji as a button that opens the same // picker as the icon of an open note (Doku/ui-patterns.md). export const EmojiIconButton: React.FC = ({ value, onChange, fallback }) => { const buttonRef = useRef(null); const [anchor, setAnchor] = useState(null); return ( <> {anchor && ( { onChange(emoji || fallback); setAnchor(null); }} onClose={() => setAnchor(null)} /> )} ); };