Hello, I'm kind of new to coding world and making my portfolio. It's nice that I can use GSAP animation for my project.
But I've been stuck with making Accordian menu.
I declared some useRefs to controll the Dom elements with Gsap animation, as I read GSAP tutorials with React.
and I made some timelines inside of useEffect, I made some functions to handle event and useRefs.
It works when I don't type on input component that I created next to the accordion ('category')
It's expanded to level 1 menus of category, and when I click the single menu(level 1), then the level2 menu is expanded.
and If I click another level1 menus of category, the level2 menu that was just opened , is closed automatically, and the level2 menu for the level1 menu that I click currently is expanded.
Also, if I click the main button(like header, it says 'category' in my demo) ,everything is closed automatically.
But It doesn't work properly once I type something on input component.
the level2 menu is not closed properly, Although I click another level1 menu. and When I click the main button, level1 menus are closed but the level2 menu that was expanded still remains. Guess reverse() animation doesn't work properly when I type or create another event.
I made a simple version of demo , I commented out some other animations in Search.js (just in case if it helpful to understand about this problem,I didn't remove)
main animation for this issue is in CateGory.js .
Also I commented out some explanation about my code.
I would really appreciate if someone can halp me.
my demo