Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web_app/src/components/stance/KineticText.tsx from CommunityOne/open-navigator: direct link, hf CLI and curl.
- Browser
- Download file 953 Bytes
-
https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_app/src/components/stance/KineticText.tsx
- Command line
-
hf download hf://spaces/CommunityOne/open-navigator/web_app/src/components/stance/KineticText.tsx
-
curl -L -o KineticText.tsx https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_app/src/components/stance/KineticText.tsx
953 Bytes
| import { Fragment, type CSSProperties } from 'react' | |
| import { titleWords } from '../../utils/storyQuestion' | |
| /** | |
| * A title whose words rise out of a mask, one after another, when its screen arrives (#915). The words stay plain inline text | |
| * for a screen reader. The motion itself is in stance.css: scrubbed by the scroll on a wide screen (`--title`), played on a | |
| * clock when the screen arrives on a phone (`data-state`), and absent under reduced motion. | |
| */ | |
| export default function KineticText({ text }: { text: string }) { | |
| const words = titleWords(text) | |
| const last = words.length - 1 | |
| return ( | |
| <> | |
| {words.map((w, i) => ( | |
| <Fragment key={i}> | |
| <span className="stance-kw"> | |
| <span className="stance-kw-i" style={{ '--wi': i, '--wf': last > 0 ? i / last : 0 } as CSSProperties}> | |
| {w} | |
| </span> | |
| </span> | |
| {i < last ? ' ' : ''} | |
| </Fragment> | |
| ))} | |
| </> | |
| ) | |
| } | |