This commit is contained in:
Manav Rathi 2024-05-08 19:47:06 +05:30
parent 477e30232c
commit 5aab9e798e
No known key found for this signature in database
3 changed files with 16 additions and 12 deletions

View file

@ -1,6 +1,6 @@
import { styled } from "@mui/material";
const colourPool = [
const colors = [
"#87CEFA", // Light Blue
"#90EE90", // Light Green
"#F08080", // Light Coral
@ -23,27 +23,31 @@ const colourPool = [
"#808000", // Light Olive
];
export const LargeType = ({ chars }: { chars: string[] }) => {
interface PairingCodeProps {
code: string;
}
export const PairingCode: React.FC<PairingCodeProps> = ({ code }) => {
return (
<Container style={{}}>
{chars.map((char, i) => (
<PairingCode_>
{code.split("").map((char, i) => (
<span
key={i}
style={{
// alternating background
// Alternating background.
backgroundColor: i % 2 === 0 ? "#2e2e2e" : "#5e5e5e",
// varying colors
color: colourPool[i % colourPool.length],
// Varying colors.
color: colors[i % colors.length],
}}
>
{char}
</span>
))}
</Container>
</PairingCode_>
);
};
const Container = styled("div")`
const PairingCode_ = styled("div")`
font-size: 4rem;
font-weight: bold;
font-family: monospace;

View file

@ -1,6 +1,6 @@
import log from "@/next/log";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { LargeType } from "components/LargeType";
import { PairingCode } from "components/PairingCode";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { storeCastData } from "services/cast";
@ -98,7 +98,7 @@ export default function Index() {
}}
>
{pairingCode ? (
<LargeType chars={pairingCode.split("")} />
<PairingCode code={pairingCode} />
) : (
<EnteSpinner />
)}

View file

@ -29,7 +29,7 @@ export default function Slideshow() {
// No items in this callection can be shown.
setIsEmpty(true);
// Go back to pairing screen after 3 seconds.
setTimeout(pair, 3000);
setTimeout(pair, 5000);
return;
}