import { ScrollArea } from '@/components/ui/scroll-area'; import { ANIMATIONS, EDIT_OBJECT, IAnimate, dispatcher, useEditorState, } from '@designcombo/core'; import React from 'react'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; const Animations = () => { const handleOnClick = (animation: any) => { dispatcher.dispatch(EDIT_OBJECT, { payload: { animation: { [animation.type]: { name: animation.name, }, }, }, }); }; const { trackItemsMap, activeIds } = useEditorState(); const targetType = trackItemsMap[activeIds[0]]?.type; const filteredAnimations = targetType === 'text' ? ANIMATIONS : ANIMATIONS.filter((animation) => animation.category === 'element'); return (
Animations
In Out {filteredAnimations .filter((i) => i.type === 'in') .map((animation, index) => (
handleOnClick(animation)} key={index} className="flex items-center gap-2 cursor-pointer" >
{animation.name || animation.type}
))}
{' '} {filteredAnimations .filter((i) => i.type === 'out') .map((animation, index) => (
handleOnClick(animation)} key={index} className="flex items-center gap-2 cursor-pointer" >
{animation.name || animation.type}
))}
); }; export default Animations;