-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e962925
commit a4ba563
Showing
5 changed files
with
181 additions
and
176 deletions.
There are no files selected for viewing
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
dapp/src/components/shared/SeasonCountdownSection/LiveTag.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from "react" | ||
import { TagProps, Tag, TagLabel, Box } from "@chakra-ui/react" | ||
import { motion } from "framer-motion" | ||
|
||
const MotionBox = motion(Box) | ||
|
||
export function LiveTag(props: TagProps) { | ||
return ( | ||
<Tag | ||
px={4} | ||
py={2} | ||
rounded="3xl" | ||
bg="grey.700" | ||
variant="solid" | ||
pos="relative" | ||
{...props} | ||
> | ||
<Box rounded="full" w={2} h={2} mr={3} bg="brand.400" /> | ||
<MotionBox | ||
pos="absolute" | ||
rounded="full" | ||
w={2} | ||
h={2} | ||
bg="brand.400" | ||
animate={{ scale: [1, 6], opacity: [0.5, 0] }} | ||
transition={{ | ||
duration: 2, | ||
ease: "easeInOut", | ||
repeat: Infinity, | ||
}} | ||
/> | ||
<TagLabel | ||
color="gold.200" | ||
textTransform="uppercase" | ||
fontStyle="italic" | ||
overflow="visible" | ||
fontSize="md" | ||
lineHeight={5} | ||
fontWeight="bold" | ||
> | ||
Live | ||
</TagLabel> | ||
</Tag> | ||
) | ||
} |
125 changes: 125 additions & 0 deletions
125
dapp/src/components/shared/SeasonCountdownSection/SeasonCountdownSectionBackground.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import React, { useRef } from "react" | ||
import { Box } from "@chakra-ui/react" | ||
import seasonCountdownBackground from "#/assets/images/season-countdown-section-background.png" | ||
import seasonCountdownForeground from "#/assets/images/season-countdown-section-foreground.png" | ||
import { | ||
MotionValue, | ||
motion, | ||
useScroll, | ||
useSpring, | ||
useTransform, | ||
useTime, | ||
wrap, | ||
} from "framer-motion" | ||
|
||
export function SeasonCountdownSectionBackground() { | ||
const containerRef = useRef(null) | ||
const { scrollYProgress } = useScroll({ | ||
target: containerRef, | ||
offset: ["center start", "start end"], | ||
}) | ||
const smoothScrollYProgress = useSpring(scrollYProgress, { | ||
damping: 10, | ||
stiffness: 90, | ||
mass: 0.75, | ||
}) as MotionValue<number> | ||
const foregroundParallax = useTransform( | ||
smoothScrollYProgress, | ||
[0, 1], | ||
["25%", "65%"], | ||
) | ||
const time = useTime() | ||
// Seed value is wrapped to prevent infinite increment causing potential memory leaks | ||
const seed = useTransform(time, (value) => wrap(0, 2137, Math.floor(value))) | ||
|
||
return ( | ||
<Box | ||
as="svg" | ||
ref={containerRef} | ||
w="full" | ||
h="full" | ||
minH={720} | ||
rounded="2xl" | ||
pos="absolute" | ||
inset={0} | ||
zIndex={-1} | ||
> | ||
<defs> | ||
<filter | ||
id="noise-filter" | ||
x="-20%" | ||
y="-20%" | ||
width="140%" | ||
height="140%" | ||
filterUnits="objectBoundingBox" | ||
primitiveUnits="userSpaceOnUse" | ||
colorInterpolationFilters="linearRGB" | ||
> | ||
<motion.feTurbulence | ||
type="fractalNoise" | ||
baseFrequency="0.119" | ||
numOctaves="4" | ||
seed={seed} | ||
stitchTiles="stitch" | ||
x="0%" | ||
y="0%" | ||
width="100%" | ||
height="100%" | ||
result="turbulence" | ||
/> | ||
<feSpecularLighting | ||
surfaceScale="4" | ||
specularConstant="3" | ||
specularExponent="20" | ||
lightingColor="#0600ff" | ||
x="0%" | ||
y="0%" | ||
width="100%" | ||
height="100%" | ||
in="turbulence" | ||
result="specularLighting" | ||
> | ||
<feDistantLight azimuth="3" elevation="107" /> | ||
</feSpecularLighting> | ||
<feColorMatrix | ||
type="saturate" | ||
values="0" | ||
x="0%" | ||
y="0%" | ||
width="100%" | ||
height="100%" | ||
in="specularLighting" | ||
result="colormatrix" | ||
/> | ||
</filter> | ||
</defs> | ||
<Box as="rect" x="0" y="0" w="full" h="full" fill="brand.400" /> | ||
<Box as="g" mixBlendMode="overlay"> | ||
<Box | ||
as="image" | ||
href={seasonCountdownBackground} | ||
w="full" | ||
h="full" | ||
preserveAspectRatio="xMidYMin slice" | ||
/> | ||
<Box | ||
as={motion.image} | ||
href={seasonCountdownForeground} | ||
w="full" | ||
h="full" | ||
preserveAspectRatio="xMinYMin slice" | ||
y={foregroundParallax} | ||
/> | ||
</Box> | ||
<Box | ||
as="rect" | ||
mixBlendMode="soft-light" | ||
w="full" | ||
h="full" | ||
fill="#0600ff" | ||
filter="url(#noise-filter)" | ||
opacity={0.64} | ||
/> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./LiveTag" | ||
export * from "./CountdownTimer" | ||
export * from "./SeasonCountdownSectionBackground" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters