Added customisable rainbow text page for custom marketing material and goofing around main

This commit is contained in:
Nikolaj Frey 2023-11-08 17:27:12 +11:00
parent bd8f06ae89
commit 04329c490d
4 changed files with 88 additions and 6 deletions

View File

@ -8,9 +8,18 @@ export const Splash = (props) => {
alignItems="center" alignItems="center"
justifyContent="center" justifyContent="center"
width="100vw" width="100vw"
height="100vh" maxWidth="100vw"
minHeight="100vh"
paddingY="100px"
> >
<TextAnimation1></TextAnimation1> <Flex
alignItems="center"
justifyContent="center"
width="800px"
textAlign="center"
>
<TextAnimation1 ce={props?.ce} texts={props?.texts}></TextAnimation1>
</Flex>
</Flex> </Flex>
) )
} }

View File

@ -8,18 +8,28 @@ export const RainbowText = (props) => {
sx={{ sx={{
"@keyframes moving-rainbow": { "@keyframes moving-rainbow": {
"0%": { backgroundPosition: "0 0" }, "0%": { backgroundPosition: "0 0" },
"100%": { backgroundPosition: "200% 0" }, "100%": { backgroundPosition: "calc(100px + 200%) 0" },
}, },
animation: "moving-rainbow 5s infinite linear", animation: "moving-rainbow 5s infinite linear",
"::selection": {
background: "transparent",
},
"::-moz-selection": {
background: "transparent",
},
}} }}
position="relative" position="relative"
maxWidth="100%"
color="transparent" color="transparent"
fontSize="6xl" fontSize="6xl"
fontWeight="bold" fontWeight="bold"
backgroundSize="200%" backgroundSize="calc(100px + 200%)"
bgGradient="linear-gradient(to right, #f34a4a, #ffbc48, #58ca70, #47b5e6, #a555e8, #f34a4a)" bgGradient="linear-gradient(to right, #f34a4a, #ffbc48, #58ca70, #47b5e6, #a555e8, #f34a4a)"
backgroundClip="text" backgroundClip="text"
userSelect="none" userSelect="none"
outline="none"
contentEditable={props?.ce}
spellcheck="false"
> >
{props?.children} {props?.children}
</Text> </Text>

View File

@ -5,6 +5,10 @@ import { RainbowText } from "./rainbowText"
export const TextAnimation1 = (props) => { export const TextAnimation1 = (props) => {
const texts = React.useMemo(() => { const texts = React.useMemo(() => {
if (props?.texts?.length) {
return props?.texts
}
return [ return [
"thingtime", "thingtime",
"vibrant", "vibrant",
@ -16,7 +20,7 @@ export const TextAnimation1 = (props) => {
"love", "love",
// 'tt' // 'tt'
] ]
}, []) }, [props?.texts])
const [titleText, setTitleText] = React.useState(texts[0]) const [titleText, setTitleText] = React.useState(texts[0])
@ -48,5 +52,5 @@ export const TextAnimation1 = (props) => {
}, newTimeout) }, newTimeout)
}, [titleText]) }, [titleText])
return <RainbowText>{titleText}</RainbowText> return <RainbowText ce={props?.ce}>{titleText}</RainbowText>
} }

View File

@ -0,0 +1,59 @@
import React from "react"
import { Flex } from "@chakra-ui/react"
import { useLocation } from "@remix-run/react"
import { Splash } from "~/components/Splash/Splash"
import { useThingtime } from "~/components/Thingtime/useThingtime"
export default function Index() {
const location = useLocation()
const { pathname } = location
const strippedPathname = React.useMemo(() => {
// modify /rainbow/* to just *
const ret = pathname.split("/")[2]
if (ret) {
return decodeURI(ret)
}
return "rainbow"
}, [pathname])
const texts = React.useMemo(() => {
const ret = [strippedPathname]
return ret
}, [strippedPathname])
return (
<Flex
sx={{
"::selection": {
background: "transparent",
},
"::-moz-selection": {
background: "transparent",
},
"*": {
"::selection": {
background: "transparent",
},
"::-moz-selection": {
background: "transparent",
},
},
"* grammarly-extension": {
display: "none !important",
},
}}
alignItems="center"
justifyContent="center"
flexDirection="column"
maxWidth="100%"
>
<Splash texts={texts} ce={true}></Splash>
</Flex>
)
}