diff --git a/remix/app/components/rainbowText.tsx b/remix/app/components/rainbowText.tsx new file mode 100644 index 0000000..62b7247 --- /dev/null +++ b/remix/app/components/rainbowText.tsx @@ -0,0 +1,25 @@ +import { Text } from '@chakra-ui/react' +import React from 'react' + +export const RainbowText = props => { + return ( + + {props?.children} + + ) +} diff --git a/remix/app/components/textAnimation1.tsx b/remix/app/components/textAnimation1.tsx new file mode 100644 index 0000000..031400d --- /dev/null +++ b/remix/app/components/textAnimation1.tsx @@ -0,0 +1,36 @@ +import { RainbowText } from './rainbowText' +import React from 'react' + +export const TextAnimation1 = props => { + const texts = React.useMemo(() => { + return [ + // 't', + 'tt', + 'thingtime' + // 'tt / thingtime' + // 'tht', + // 'thit', + // 'thint', + // 'thingt', + // 'thingti', + // 'thingtim', + // 'thingtime', + // 'Thingtime', + // 'ThingTime', + // 'Thing Time' + ] + }, []) + + const [titleText, setTitleText] = React.useState(texts[0]) + + React.useEffect(() => { + const interval = setInterval(() => { + const newTextIdx = texts?.indexOf(titleText) + 1 + const newText = texts[newTextIdx] || texts[0] + setTitleText(newText) + }, 5000) + return () => clearInterval(interval) + }, [titleText, texts]) + + return {titleText} +} diff --git a/remix/app/routes/index.tsx b/remix/app/routes/index.tsx index ea1ffc2..98de553 100644 --- a/remix/app/routes/index.tsx +++ b/remix/app/routes/index.tsx @@ -1,80 +1,9 @@ -import { Box, Flex, Text } from '@chakra-ui/react' -import React from 'react' - +import { Flex } from '@chakra-ui/react' +import { TextAnimation1 } from '~/components/textAnimation1' export default function Index () { - const texts = [ - // 't', - 'tt', - '/', - 'thingtime' - // 'tht', - // 'thit', - // 'thint', - // 'thingt', - // 'thingti', - // 'thingtim', - // 'thingtime', - // 'Thingtime', - // 'ThingTime', - // 'Thing Time' - ] - - const [titleText, setTitleText] = React.useState(texts[0]) - - const [started, setStarted] = React.useState(false) - - // const mainText = 'Thing Time' - // const mainText = "Thingtime" - const mainText = 'thingtime' - - React.useEffect(() => { - const interval = setInterval(() => { - const newTextIdx = texts?.indexOf(titleText) + 1 - const newText = texts[newTextIdx] || texts[0] - setTitleText(newText) - // if (titleText === 'tt') { - // setTitleText('tt.') - // } else if (titleText === 'tt.') { - // setTitleText('tt..') - // } else if (titleText === 'tt..') { - // setTitleText('tt...') - // } else if (titleText === 'tt...') { - // setTitleText(mainText) - // } else if (titleText === mainText) { - // if (!started) { - // setStarted(true) - // setTimeout(() => { - // setTitleText('tt') - // setStarted(false) - // }, 15000) - // } - // } - }, 2000) - return () => clearInterval(interval) - }, [titleText, started]) - return ( - <> - - - {titleText} - - - + + + ) } diff --git a/remix/public/favicon.ico b/remix/public/favicon.ico index 8830cf6..6a7e967 100644 Binary files a/remix/public/favicon.ico and b/remix/public/favicon.ico differ