fix: make tag selected on second click
This commit is contained in:
@@ -11,6 +11,7 @@ type Props = {
|
|||||||
|
|
||||||
export const NoteTag = observer(({ appState, tag }: Props) => {
|
export const NoteTag = observer(({ appState, tag }: Props) => {
|
||||||
const [showDeleteButton, setShowDeleteButton] = useState(false);
|
const [showDeleteButton, setShowDeleteButton] = useState(false);
|
||||||
|
const [tagClicked, setTagClicked] = useState(false);
|
||||||
const deleteTagRef = useRef<HTMLButtonElement>();
|
const deleteTagRef = useRef<HTMLButtonElement>();
|
||||||
|
|
||||||
const deleteTag = () => {
|
const deleteTag = () => {
|
||||||
@@ -18,7 +19,12 @@ export const NoteTag = observer(({ appState, tag }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onTagClick = () => {
|
const onTagClick = () => {
|
||||||
appState.setSelectedTag(tag);
|
if (tagClicked) {
|
||||||
|
setTagClicked(false);
|
||||||
|
appState.setSelectedTag(tag);
|
||||||
|
} else {
|
||||||
|
setTagClicked(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFocus = () => {
|
const onFocus = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user