Skip to content

Instantly share code, notes, and snippets.

@3200pro
Created November 29, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3200pro/593ba1ef34ce05ffca5a1f1d4d6bed52 to your computer and use it in GitHub Desktop.
Save 3200pro/593ba1ef34ce05ffca5a1f1d4d6bed52 to your computer and use it in GitHub Desktop.
Sanity Schema - Shuffled Text - Part 5 Gatsby Integration
/** @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