mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-20 18:40:17 -04:00
Added documentation for TagsHandler
This commit is contained in:
parent
bcfca9e169
commit
476016117b
|
@ -1,5 +1,13 @@
|
||||||
import { useState } from 'react';
|
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[]) {
|
export default function useTagsHandler(initialOptions: string[]) {
|
||||||
const [presetOptions, setPresetOptions] = useState(initialOptions);
|
const [presetOptions, setPresetOptions] = useState(initialOptions);
|
||||||
const [tagColors, setTagColors] = useState(new Map<string, string>());
|
const [tagColors, setTagColors] = useState(new Map<string, string>());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user