From 2f163fe22360d7b413b339e7567cd76e5a12b23b Mon Sep 17 00:00:00 2001 From: Nick A Date: Tue, 22 Oct 2024 18:10:05 -0400 Subject: [PATCH] Added documentation for TagsHandler --- compass/components/TagsInput/TagsHandler.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compass/components/TagsInput/TagsHandler.tsx b/compass/components/TagsInput/TagsHandler.tsx index 0deba6b..e8fde75 100644 --- a/compass/components/TagsInput/TagsHandler.tsx +++ b/compass/components/TagsInput/TagsHandler.tsx @@ -1,5 +1,13 @@ import { useState } from 'react'; +/** + * Custom hook used to handle the state of tag options and colors + * @param initialOptions Initial value for preset options + * @returns An object with three fields intended to be passed into a `TagsInput` component: + * - `presetOptions` - the current state of tag options + * - `setPresetOptions` - the state setter for presetOptions + * - `getTagColor` - function that retrieves the color for the given tag + */ export default function useTagsHandler(initialOptions: string[]) { const [presetOptions, setPresetOptions] = useState(initialOptions); const [tagColors, setTagColors] = useState(new Map());