Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions website/src/components/hero/Hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import Christmas from "./christmas";
import Chicken from "./chicken";
import Pride from "./pride";
import Halloween from "./halloween";
import Game from "./game";
import { EASTER_EGG_CREDENTIAL } from "@/utils/credentials";

import styles from "./Hero.module.css";
import Future from "./future";
Expand All @@ -31,6 +33,7 @@ export default function Hero({ className = "" }) {
const [isSubmittingCredential, setIsSubmittingCredential] = useState(false);
const [showApplications, setShowApplications] = useState(false);
const [applicationsOpenMode, setApplicationsOpenMode] = useState("default");
const [isGameActive, setIsGameActive] = useState(false);

const { selectedCredential: selectedToken } = useSelectedCredential();
const { getCredentialEntry } = useCredentialEntries();
Expand Down Expand Up @@ -78,6 +81,9 @@ export default function Hero({ className = "" }) {
: "";
const hasActiveClientSummary = Boolean(selectedToken && resolvedDisplayName);
const inputIsValid = hasResolvedCredential || canSubmitCredential;
const isGameReady =
selectedToken?.type === "easteregg" ||
selectedToken?.token === EASTER_EGG_CREDENTIAL;

function handleOpenClientConnect() {
setApplicationsOpenMode("add");
Expand All @@ -93,16 +99,24 @@ export default function Hero({ className = "" }) {
}

return (
<section className={`${styles.hero} ${className}`} id="hero">
<section
className={`${styles.hero} ${isGameActive ? styles.heroGameActive : ""} ${className}`}
id="hero"
>
<div className={styles.color} />
<div className={styles.silhouette} />
{isChristmas && <Christmas />}
{isEaster && <Chicken />}
{isPride && <Pride />}
{isHalloween && <Halloween />}
{isFuture && <Future />}
<Game
className={styles.gameLayer}
isActive={isGameActive}
onActiveChange={setIsGameActive}
/>
<Container>
<Row className={styles.row}>
<Row className={`${styles.row} ${styles.contentRow}`}>
<Col>
<Title className={styles.title}>
<Label for="token-input">
Expand All @@ -112,15 +126,20 @@ export default function Hero({ className = "" }) {
</Col>
</Row>

<Row className={styles.row}>
<Row className={`${styles.row} ${styles.contentRow}`}>
<Col>
<div className={styles.inputGroup}>
<Connect
id="token-input"
className={styles.token}
onValidityChange={setCanSubmitCredential}
onPendingChange={setIsSubmittingCredential}
onSubmit={() => {
onSubmit={(value) => {
if (value === EASTER_EGG_CREDENTIAL) {
setIsGameActive(true);
return;
}

router.push({
pathname: "/documentation",
});
Expand Down Expand Up @@ -152,7 +171,7 @@ export default function Hero({ className = "" }) {
</Col>
</Row>

<Row className={styles.row}>
<Row className={`${styles.row} ${styles.contentRow}`}>
<Col>
<Button
className={styles.go}
Expand All @@ -170,7 +189,7 @@ export default function Hero({ className = "" }) {
/>
</>
) : (
"Go!"
isGameReady ? "Start game" : "Go!"
)}
</Button>
</Col>
Expand Down
48 changes: 48 additions & 0 deletions website/src/components/hero/Hero.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
transform: scale(1.1);
animation: heroGradientFlow 30s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite
alternate;
transition:
opacity 220ms ease,
background 220ms ease,
filter 220ms ease;
}

.color::before,
Expand Down Expand Up @@ -124,6 +128,7 @@
z-index: -2;
opacity: 0.75;
display: none;
transition: opacity 220ms ease;
}

.hero .row:first-of-type > div {
Expand Down Expand Up @@ -157,15 +162,28 @@
margin-bottom: 2px;
}

.gameLayer {
position: absolute;
inset: 0;
}

.title {
color: var(--white);
align-self: center;
text-shadow: 0 8px 32px rgba(8, 17, 38, 0.3);
transition:
color 220ms ease,
opacity 220ms ease,
transform 220ms ease;
}

.help {
color: var(--text-light);
margin-top: var(--pt1);
transition:
color 220ms ease,
opacity 220ms ease,
transform 220ms ease;
}

.history {
Expand All @@ -188,6 +206,27 @@
z-index: 2;
}

.contentRow > div {
transition:
opacity 220ms ease,
transform 220ms ease;
}

.heroGameActive .silhouette {
opacity: 0.45;
}

.heroGameActive .title,
.heroGameActive .help {
color: var(--white);
text-shadow: 0 8px 32px rgba(8, 17, 38, 0.3);
}

.heroGameActive .contentRow > div {
opacity: 0.85;
transform: none;
}

.hero > div {
display: flex;
flex-flow: column;
Expand Down Expand Up @@ -276,6 +315,7 @@
.token {
display: none !important;
}

}

@media screen and (max-width: 576px) {
Expand All @@ -301,6 +341,14 @@
.color::after {
filter: blur(24px);
}

.hero {
padding-bottom: var(--pt12);
}

.heroGameActive .contentRow > div {
opacity: 0.18;
}
}

@media screen and (min-width: 1201px) {
Expand Down
Loading