From e1b6048ae4a5a9518393e2e1788b6451d41a2fe9 Mon Sep 17 00:00:00 2001 From: jsun969 Date: Tue, 24 Sep 2024 20:34:37 +0930 Subject: [PATCH] feat: set help steps to start when close help modal --- src/components/HelpModal.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/HelpModal.tsx b/src/components/HelpModal.tsx index 3817077..bdbb833 100644 --- a/src/components/HelpModal.tsx +++ b/src/components/HelpModal.tsx @@ -11,7 +11,7 @@ import { Tabs, } from '@nextui-org/react'; import { AnimatePresence, motion } from 'framer-motion'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { useHelpModal } from '../helpers/help-modal'; @@ -85,6 +85,13 @@ export const HelpModal = () => { }), }; + useEffect(() => { + if (!helpModal.isOpen) { + setStepIndex(0); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [helpModal.isOpen]); + const step = STEPS[stepIndex]; return (