Skip to content

Commit

Permalink
Made animation by type (#738)
Browse files Browse the repository at this point in the history
Co-authored-by: Ruben Fiszel <[email protected]>
  • Loading branch information
fatonramadani and rubenfiszel authored Oct 30, 2024
1 parent cc7c8ba commit 9c94dab
Show file tree
Hide file tree
Showing 10 changed files with 298 additions and 245 deletions.
6 changes: 3 additions & 3 deletions src/landing/AppAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { SiTypescript } from 'react-icons/si';
import { twMerge } from 'tailwind-merge';
import { motion } from 'framer-motion';

export default function AppAnimation({ active }) {
const [step, setStep] = React.useState(0);
export default function AppAnimation({ active, only }) {
const [step, setStep] = React.useState(only ? 0 : -1);
const [scriptStep, setScriptStep] = React.useState(0);
const [buttonName, setButtonName] = React.useState('Press me');
const [clicked, setClicked] = React.useState(false);
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function AppAnimation({ active }) {
}
};

useAnimateScroll(active, steps, appScrollCount, flowScrollCount + scriptScrollCount);
useAnimateScroll(active, steps, appScrollCount, only ? 0 : flowScrollCount + scriptScrollCount);

return (
<div className=" bg-gradient-to-br from-orange-200 to-orange-400 dark:from-orange-700 dark:to-orange-600 w-full rounded-lg p-6 shadow-inner overflow-hidden h-[550px]">
Expand Down
7 changes: 4 additions & 3 deletions src/landing/FlowAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const initialEdges = [
{ id: '6-7', source: '6', target: '7' }
];

export default function FlowAnimation({ active }) {
export default function FlowAnimation({ active, only }) {
const [initialNodes, setInitialNodes] = React.useState<
Array<{
id: string;
Expand Down Expand Up @@ -110,7 +110,7 @@ export default function FlowAnimation({ active }) {

const [windowIndex, setWindowIndex] = React.useState(0);
const [bgColor, setBgColor] = React.useState('black');
const [step, setStep] = React.useState(-1);
const [step, setStep] = React.useState(only ? 0 : -1);
const nodeTypes = useMemo(() => ({ textUpdater: Node }), []);
const [selectedFile, setSelectedFile] = React.useState('your_flow.yaml');

Expand Down Expand Up @@ -170,6 +170,7 @@ schema:
i === 7 ? { ...node, data: { ...node.data, selected: true } } : node
)
);

setStep(0);
},
rollback: () => {
Expand Down Expand Up @@ -318,7 +319,7 @@ schema:
}
];

useAnimateScroll(active, steps, flowScrollCount, scriptScrollCount);
useAnimateScroll(active, steps, flowScrollCount, only ? 0 : scriptScrollCount);

const currentText = `import Stripe from 'stripe';
Expand Down
Loading

0 comments on commit 9c94dab

Please sign in to comment.