Created
November 29, 2020 13:34
-
-
Save 3200pro/593ba1ef34ce05ffca5a1f1d4d6bed52 to your computer and use it in GitHub Desktop.
Sanity Schema - Shuffled Text - Part 5 Gatsby Integration
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
/** @jsx jsx */ | |
import { jsx } from "theme-ui" | |
import React, { useState } from 'react' | |
import TextScramble from './textShuffleMaster' | |
function ShuffleText (props) { | |
const Style = props.textSection[0].textStyle ? props.textSection[0].textStyle: 'span' | |
const ShuffleText = props.textSection && props.textSection[0].phrase | |
const [pause] = useState(false) | |
return ( | |
<Style> | |
{ShuffleText ? ShuffleText.map(section => ( | |
<> | |
{section.string ? section.string : | |
<section.textStyle key={section.key} > | |
<TextScramble | |
texts={section.text} | |
letterSpeed={5} | |
nextLetterSpeed={100} | |
pauseTime={3000} | |
paused={pause} | |
/> | |
</section.textStyle> } | |
</> | |
)): null} | |
</Style> | |
) | |
} | |
export default ShuffleText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment