1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-11-22 16:24:19 +00:00

Move useCycleState to (utils)

This commit is contained in:
Steffo 2023-08-08 17:52:21 +02:00
parent 03fc7286a9
commit 04d76c2a70
Signed by: steffo
GPG key ID: 2A24051445686895
2 changed files with 6 additions and 1 deletions

View file

@ -1,6 +1,11 @@
import {useCallback, useMemo, useState} from "react" import {useCallback, useMemo, useState} from "react"
/**
* **Hook** similar to {@link useState}, but which allows a value to be chosen from a cycle of items.
*
* @param items The items in the cycle.
*/
export function useCycleState(items: any[]) { export function useCycleState(items: any[]) {
const [index, setIndex] = useState<number>(0); const [index, setIndex] = useState<number>(0);

View file

@ -7,7 +7,7 @@ import {useBoardTaskEditor} from "@/app/[lang]/board/[board]/useBoardTaskEditor"
import {useBoardWs} from "@/app/[lang]/board/[board]/useBoardWs" import {useBoardWs} from "@/app/[lang]/board/[board]/useBoardWs"
import {TaskGroup, useBoardTaskArranger} from "@/app/[lang]/board/[board]/useBoardTaskArranger" import {TaskGroup, useBoardTaskArranger} from "@/app/[lang]/board/[board]/useBoardTaskArranger"
import {useBoardTitleEditor} from "@/app/[lang]/board/[board]/useBoardTitleEditor" import {useBoardTitleEditor} from "@/app/[lang]/board/[board]/useBoardTitleEditor"
import {useCycleState} from "@/app/[lang]/useCycleState" import {useCycleState} from "@/app/(utils)/useCycleState"
import {Dispatch, SetStateAction, useState} from "react" import {Dispatch, SetStateAction, useState} from "react"
export interface UseBoardReturns { export interface UseBoardReturns {