diff --git a/src/renderer/features/sidebar/components/playlist-folder-tree.module.css b/src/renderer/features/sidebar/components/playlist-folder-tree.module.css index b66a69c38..498f7a522 100644 --- a/src/renderer/features/sidebar/components/playlist-folder-tree.module.css +++ b/src/renderer/features/sidebar/components/playlist-folder-tree.module.css @@ -22,7 +22,7 @@ gap: var(--theme-spacing-md); align-items: center; width: 100%; - padding: var(--theme-spacing-xs) var(--theme-spacing-md); + padding: var(--theme-spacing-sm) var(--theme-spacing-md); font: inherit; color: inherit; text-align: left; @@ -32,12 +32,18 @@ border-radius: var(--theme-radius-md); &:hover { - background-color: var(--theme-colors-surface); + background-color: var(--theme-colors-background); } } .chevron { + display: flex; flex-shrink: 0; + align-items: center; +} + +.collapse { + overflow: hidden; } .name { diff --git a/src/renderer/features/sidebar/components/playlist-folder-tree.tsx b/src/renderer/features/sidebar/components/playlist-folder-tree.tsx index 0487af289..b766ecd5c 100644 --- a/src/renderer/features/sidebar/components/playlist-folder-tree.tsx +++ b/src/renderer/features/sidebar/components/playlist-folder-tree.tsx @@ -1,9 +1,11 @@ import clsx from 'clsx'; +import { motion } from 'motion/react'; import { ComponentPropsWithoutRef, CSSProperties, MouseEvent, ReactElement, + ReactNode, useCallback, useMemo, useState, @@ -33,6 +35,25 @@ import { DragData, DragOperation, DragTarget } from '/@/shared/types/drag-and-dr const STORAGE_KEY_PREFIX = 'feishin:playlist-folder-state'; +const FOLDER_COLLAPSE_TRANSITION = { duration: 0.2, ease: 'easeInOut' } as const; + +interface PlaylistFolderCollapseProps { + children: ReactNode; + className?: string; + open: boolean; +} + +const PlaylistFolderCollapse = ({ children, className, open }: PlaylistFolderCollapseProps) => ( + + {children} + +); + export const getPlaylistLeafName = (name: string, separator: string): string => { if (!separator) return name; const segments = name.split(separator).filter((segment) => segment.length > 0); @@ -457,7 +478,7 @@ const PlaylistFolderHeader = ({ type="button" >
- +
{name} @@ -482,18 +503,21 @@ const PlaylistFolderHeader = ({ style={{ opacity: isDragging ? 0.5 : 1 }} type="button" > - - + {name} {leafCount} + + + ); }; @@ -724,20 +748,18 @@ export const PlaylistFolderTree = ({ onClick={() => onToggleFolder(group.name)} variant="header" /> - {isOpen && ( -
- {group.items.map((item) => ( - - ))} -
- )} + + {group.items.map((item) => ( + + ))} + ); })} @@ -788,15 +810,13 @@ export const PlaylistFolderTreeView = ({ onClick={() => onToggleFolder(node.path)} variant="header" /> - {isOpen && ( -
- {node.children.map((child) => ( -
- {renderNode(child)} -
- ))} -
- )} + + {node.children.map((child) => ( +
+ {renderNode(child)} +
+ ))} +
); }; diff --git a/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx b/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx index 39502b5de..a55cad901 100644 --- a/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx +++ b/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx @@ -571,7 +571,7 @@ export const SidebarPlaylistList = () => { {inNavigation ? navigation.currentName : t('page.sidebar.playlists')}
- +