diff --git a/rsconcept/frontend/src/pages/LibraryPage/ViewSideLocation.tsx b/rsconcept/frontend/src/pages/LibraryPage/ViewSideLocation.tsx index eb4fe307..78c023d9 100644 --- a/rsconcept/frontend/src/pages/LibraryPage/ViewSideLocation.tsx +++ b/rsconcept/frontend/src/pages/LibraryPage/ViewSideLocation.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import { motion } from 'framer-motion'; -import { useCallback } from 'react'; +import { useCallback, useMemo } from 'react'; import { toast } from 'react-toastify'; import { IconFolderTree } from '@/components/Icons'; @@ -8,9 +8,10 @@ import BadgeHelp from '@/components/info/BadgeHelp'; import { CProps } from '@/components/props'; import SelectLocation from '@/components/select/SelectLocation'; import MiniButton from '@/components/ui/MiniButton'; +import useWindowSize from '@/hooks/useWindowSize'; import { FolderNode, FolderTree } from '@/models/FolderTree'; import { HelpTopic } from '@/models/miscellaneous'; -import { animateSideView } from '@/styling/animations'; +import { animateSideMinWidth } from '@/styling/animations'; import { PARAMETER, prefixes } from '@/utils/constants'; import { information } from '@/utils/labels'; @@ -22,6 +23,7 @@ interface ViewSideLocationProps { } function ViewSideLocation({ folderTree, active, setActive: setActive, toggleFolderMode }: ViewSideLocationProps) { + const windowSize = useWindowSize(); const handleClickFolder = useCallback( (event: CProps.EventMouse, target: FolderNode) => { event.preventDefault(); @@ -38,12 +40,14 @@ function ViewSideLocation({ folderTree, active, setActive: setActive, toggleFold [setActive] ); + const animations = useMemo(() => animateSideMinWidth(windowSize.isSmall ? '10rem' : '15rem'), [windowSize]); + return (
({ + initial: { + minWidth: 0, + opacity: 0 + }, + animate: { + minWidth: width, + opacity: 1, + transition: { + width: { + duration: 0.4 + }, + opacity: { + delay: 0.4, + duration: 0 + } + } + }, + exit: { + minWidth: 0, + opacity: 0, + transition: { + width: { + duration: 0.4 + }, + opacity: { + duration: 0 + } + } + } +}); + export const animateSideAppear = { initial: { height: 0,