mirror of
https://github.com/aljazceru/AgentGPT.git
synced 2025-12-17 05:54:20 +01:00
🎨 Add dots animation
This commit is contained in:
@@ -3,6 +3,7 @@ import React, { useEffect, useRef, useState } from "react";
|
|||||||
import { FaBrain, FaListAlt, FaPlayCircle, FaStar } from "react-icons/fa";
|
import { FaBrain, FaListAlt, FaPlayCircle, FaStar } from "react-icons/fa";
|
||||||
import autoAnimate from "@formkit/auto-animate";
|
import autoAnimate from "@formkit/auto-animate";
|
||||||
import PopIn from "./motions/popin";
|
import PopIn from "./motions/popin";
|
||||||
|
import Expand from "./motions/expand";
|
||||||
|
|
||||||
interface ChatWindowProps {
|
interface ChatWindowProps {
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
@@ -57,7 +58,7 @@ const ChatWindow = ({ messages, children, className }: ChatWindowProps) => {
|
|||||||
{children}
|
{children}
|
||||||
|
|
||||||
{messages.length === 0 ? (
|
{messages.length === 0 ? (
|
||||||
<PopIn delay={1}>
|
<Expand delay={0.8} type="spring">
|
||||||
<ChatMessage
|
<ChatMessage
|
||||||
message={{
|
message={{
|
||||||
type: "system",
|
type: "system",
|
||||||
@@ -65,7 +66,7 @@ const ChatWindow = ({ messages, children, className }: ChatWindowProps) => {
|
|||||||
"> Create an agent by adding a name / goal, and hitting deploy!",
|
"> Create an agent by adding a name / goal, and hitting deploy!",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</PopIn>
|
</Expand>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
@@ -77,9 +78,15 @@ const ChatWindow = ({ messages, children, className }: ChatWindowProps) => {
|
|||||||
const MacWindowHeader = () => {
|
const MacWindowHeader = () => {
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-1 rounded-t-3xl p-3">
|
<div className="flex gap-1 rounded-t-3xl p-3">
|
||||||
|
<PopIn delay={0.4}>
|
||||||
<div className="h-3 w-3 rounded-full bg-red-500" />
|
<div className="h-3 w-3 rounded-full bg-red-500" />
|
||||||
|
</PopIn>
|
||||||
|
<PopIn delay={0.5}>
|
||||||
<div className="h-3 w-3 rounded-full bg-yellow-500" />
|
<div className="h-3 w-3 rounded-full bg-yellow-500" />
|
||||||
|
</PopIn>
|
||||||
|
<PopIn delay={0.6}>
|
||||||
<div className="h-3 w-3 rounded-full bg-green-500" />
|
<div className="h-3 w-3 rounded-full bg-green-500" />
|
||||||
|
</PopIn>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,13 +4,18 @@ import type { PropsWithChildren } from "react";
|
|||||||
interface MotionProps extends PropsWithChildren {
|
interface MotionProps extends PropsWithChildren {
|
||||||
className?: string;
|
className?: string;
|
||||||
delay?: number;
|
delay?: number;
|
||||||
|
type?: "spring" | "tween";
|
||||||
}
|
}
|
||||||
|
|
||||||
const Expand = (props: MotionProps) => (
|
const Expand = (props: MotionProps) => (
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ scaleX: 0.8, scaleY: 0 }}
|
initial={{ scaleX: 0.8, scaleY: 0 }}
|
||||||
animate={{ scaleX: 1, scaleY: 1 }}
|
animate={{ scaleX: 1, scaleY: 1 }}
|
||||||
transition={{ duration: 0.75, type: "spring", delay: props.delay ?? 0 }}
|
transition={{
|
||||||
|
duration: 0.75,
|
||||||
|
type: props.type ?? "spring",
|
||||||
|
delay: props.delay ?? 0,
|
||||||
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
|
|||||||
Reference in New Issue
Block a user