Skip to content

Commit

Permalink
randomise launch demo
Browse files Browse the repository at this point in the history
  • Loading branch information
lewhunt committed May 14, 2024
1 parent 59209b9 commit 124d74d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { useState } from "react";
import { useState, useEffect } from "react";
import { Divz, DivzVideoItem } from "./lib/Divz";
import "./App.css";

function App() {
const [demo, setDemo] = useState<number>(3);
const [demo, setDemo] = useState<number>(1);

/* hard-coded to demo 3 for now
useEffect(() => randomizeDemo(), []);

const randomizeDemo = () => {
const randomNumber = Math.floor(Math.random() * 4) + 1;
setDemo(randomNumber);
};
*/

const isActive = (link: number) => {
return link === demo ? "active" : "";
Expand Down Expand Up @@ -57,7 +55,7 @@ function App() {

function Demo1() {
return (
<Divz autoPlay={true} autoPlayDuration={2000} className="demo1">
<Divz autoPlay={true} autoPlayDuration={3000} className="demo1">
<div>
<h1>1</h1>
</div>
Expand Down Expand Up @@ -141,7 +139,7 @@ function Demo3() {
isDarkMode={true}
onIndexChange={(i) => setSelectedIndex(i)}
>
{/* Example of using a custom video component that loads/plays only when item is active, also with preview image */}
{/* Example of using a custom video component that loads/plays when item is active */}
{demo3Assets.map((item, index) => (
<DivzVideoItem
key={index}
Expand Down

0 comments on commit 124d74d

Please sign in to comment.