11import "./NoteColorPickerMenuItem.css" ;
2+ import { t } from "../../services/i18n" ;
23import { useCallback , useEffect , useRef , useState } from "preact/hooks" ;
34import { ComponentChildren } from "preact" ;
45import attributes from "../../services/attributes" ;
@@ -76,6 +77,7 @@ export default function NoteColorPickerMenuItem(props: NoteColorPickerMenuItemPr
7677 onClick = { ( e ) => { e . stopPropagation ( ) } } >
7778
7879 < ColorCell className = "color-cell-reset"
80+ tooltip = { t ( "note-color.clear-color" ) }
7981 color = { null }
8082 isSelected = { ( currentColor === null ) }
8183 isDisabled = { ( note === null ) }
@@ -84,13 +86,15 @@ export default function NoteColorPickerMenuItem(props: NoteColorPickerMenuItemPr
8486
8587 { COLORS . map ( ( color ) => (
8688 < ColorCell key = { color }
89+ tooltip = { t ( "note-color.set-color" ) }
8790 color = { color }
8891 isSelected = { ( color === currentColor ) }
8992 isDisabled = { ( note === null ) }
9093 onSelect = { onColorCellClicked } />
9194 ) ) }
9295
93- < CustomColorCell color = { currentColor }
96+ < CustomColorCell tooltip = { t ( "note-color.set-custom-color" ) }
97+ color = { currentColor }
9498 isSelected = { isCustomColor }
9599 isDisabled = { ( note === null ) }
96100 onSelect = { onColorCellClicked } />
@@ -99,7 +103,8 @@ export default function NoteColorPickerMenuItem(props: NoteColorPickerMenuItemPr
99103
100104interface ColorCellProps {
101105 children ?: ComponentChildren ,
102- className ?: string ;
106+ className ?: string ,
107+ tooltip ?: string ,
103108 color : string | null ,
104109 isSelected : boolean ,
105110 isDisabled ?: boolean ,
@@ -109,6 +114,7 @@ interface ColorCellProps {
109114function ColorCell ( props : ColorCellProps ) {
110115 return < div class = { `color-cell ${ props . isSelected ? "selected" : "" } ${ props . isDisabled ? "disabled-color-cell" : "" } ${ props . className ?? "" } ` }
111116 style = { `${ ( props . color !== null ) ? `--color: ${ props . color } ` : "" } ` }
117+ title = { props . tooltip }
112118 onClick = { ( ) => props . onSelect ?.( props . color ) } >
113119 { props . children }
114120 </ div > ;
0 commit comments