mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 05:36:00 +02:00
refactor album expansion to global scope
This commit is contained in:
@@ -1,32 +1,23 @@
|
||||
import { motion, Variants } from 'motion/react';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import styles from './expanded-list-container.module.css';
|
||||
|
||||
const expandedAnimationVariants: Variants = {
|
||||
hidden: {
|
||||
height: 0,
|
||||
minHeight: 0,
|
||||
},
|
||||
show: {
|
||||
minHeight: '300px',
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
ease: 'easeInOut',
|
||||
},
|
||||
},
|
||||
};
|
||||
const EXPANDED_HEIGHT = 300;
|
||||
|
||||
export const ExpandedListContainer = ({ children }: { children: ReactNode }) => {
|
||||
export interface ExpandedListContainerProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const ExpandedListContainer = ({ children }: ExpandedListContainerProps) => {
|
||||
return (
|
||||
<motion.div
|
||||
animate="show"
|
||||
<div
|
||||
className={styles.listExpandedContainer}
|
||||
exit="hidden"
|
||||
initial="hidden"
|
||||
variants={expandedAnimationVariants}
|
||||
style={{
|
||||
height: EXPANDED_HEIGHT,
|
||||
overflow: 'auto',
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user