diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx index eadee0190e..0a89c0298c 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx @@ -3,10 +3,11 @@ import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNaviga import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { styled } from '@linaria/react'; -import React from 'react'; +import { motion } from 'framer-motion'; +import React, { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; -import { IconChevronDown, IconChevronRight, Label } from 'twenty-ui/display'; -import { themeCssVariables } from 'twenty-ui/theme-constants'; +import { IconChevronRight, Label } from 'twenty-ui/display'; +import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; const StyledTitle = styled.div` align-items: center; @@ -40,11 +41,15 @@ const StyledChevron = styled.div` align-items: center; display: flex; opacity: 0; + transition: opacity calc(${themeCssVariables.animation.duration.fast} * 1s) + ease; .section-title-container:hover & { opacity: 1; } `; +const MotionIconChevronRight = motion.create(IconChevronRight); + type StyledRightIconProps = { isMobile: boolean; $alwaysVisible: boolean; @@ -75,6 +80,7 @@ export const NavigationDrawerSectionTitle = ({ alwaysShowRightIcon = false, isOpen, }: NavigationDrawerSectionTitleProps) => { + const { theme } = useContext(ThemeContext); const isMobile = useIsMobile(); const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, @@ -87,17 +93,18 @@ export const NavigationDrawerSectionTitle = ({ } }; - const ChevronIcon = isOpen === true ? IconChevronDown : IconChevronRight; - return ( {isOpen !== undefined && ( -