From 66d5a1a3681b7bdd332a5b818148d96102eb64a6 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Fri, 23 Aug 2024 16:35:31 -0400 Subject: [PATCH] feat: Add useEffect hook to Artifacts component for visibility control, slide in animation --- client/src/components/Artifacts/Artifacts.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/components/Artifacts/Artifacts.tsx b/client/src/components/Artifacts/Artifacts.tsx index 161919fda2..79db64bd15 100644 --- a/client/src/components/Artifacts/Artifacts.tsx +++ b/client/src/components/Artifacts/Artifacts.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, useState } from 'react'; +import React, { useMemo, useState, useEffect } from 'react'; import { useRecoilValue } from 'recoil'; import * as Tabs from '@radix-ui/react-tabs'; import { Sandpack } from '@codesandbox/sandpack-react'; @@ -59,10 +59,15 @@ export function ArtifactPreview({ } export default function Artifacts() { + const [isVisible, setIsVisible] = useState(false); const [activeTab, setActiveTab] = useState('code'); const artifacts = useRecoilValue(store.artifactsState); const artifactIds = useRecoilValue(store.artifactIdsState); + useEffect(() => { + setIsVisible(true); + }, []); + const [currentArtifactIndex, setCurrentArtifactIndex] = useState(artifactIds.length - 1); const currentArtifact = useMemo(() => { @@ -92,7 +97,13 @@ export default function Artifacts() { {/* Main Parent */}
{/* Main Container */} -
+
{/* Header */}