/* eslint-disable react/no-unescaped-entities */ import { DiscordLogo, GithubLogo, TwitterLogo } from 'phosphor-react' import type { Quote } from '~/components/Cards/CardCarouselQuote' import { Tile } from '~/components/Grids/NavigationGrid' import { CellData } from '~/components/Tables/TablesConfig' export const QUOTES: Quote[] = [ { text: `Holy smokes. I don't think animation can get any easier in React now with React Spring. Wrapping Reach UI (https://reach.tech/ui) in your own brand and feel is going to be so easy.`, name: 'Ryan Florence', img: 'ryan_florence.jpeg', handle: '@ryanflorence', tweetUrl: 'https://twitter.com/ryanflorence/status/1033962041298509824', job: 'Remix Co-founder', }, { text: `Big fan of React Spring!`, name: 'Ives van Hoorne', img: 'ives_van_hoorne.jpeg', handle: '@CompuIves', tweetUrl: 'https://twitter.com/CompuIves/status/1033964001246543872', job: 'Creator of Codesandbox', }, { text: `react-spring is insane. I haven't done a lot of animations but it's the first React library I come across that does it the correct way: not using setState to change styles but bypass React.`, name: 'Alexander Prinzhorn', img: 'alexander_prinzhorn.jpeg', handle: '@Prinzhorn', tweetUrl: 'https://twitter.com/Prinzhorn/status/1007560091430801409', job: 'Software Engineer', }, { text: `It's fantastic :) In my React Rally talk, I explicitly recommend it over React Motion, and all the demos use it (shout-out to @0xca0a). Will share a link to it once the talk vid is up.`, name: 'Josh W. Comeau', img: 'josh_w._comeau.jpeg', handle: '@JoshWComeau', tweetUrl: 'https://twitter.com/JoshWComeau/status/1030826919124590597', job: 'Creator of CSS for JavaScript Developers', }, { text: `If you like react-motion but feel like your transitions aren’t smooth, it’s because it’s exclusively using React rendering. If you like Popmotion but feel like you are limited by what you can do, it’s because it entirely skips React rendering. react-spring does both, try it 👌`, name: 'Pierre Bertet', img: 'pierre_bertet.jpeg', handle: '@bpierre', tweetUrl: 'https://twitter.com/bpierre/status/1032284123161931778', job: 'Software Engineer', }, { text: `react-spring by @0xca0a is a lovely animation library for react`, name: '//', img: 'no_name.jpeg', handle: '@hshoff', tweetUrl: 'https://twitter.com/hshoff/status/983054609353707520', job: 'Engineer at Airbnb', }, { text: `The animation lib React Spring is so awesome! Great API (first-class support for hooks), performant (doesn't trigger a re-render) and cross-platform (web / react-native / universal). Adding animations makes the app much more fun to use.`, name: 'bruno lemos', img: 'bruno_lemos.jpeg', handle: '@brunolemos', tweetUrl: 'https://twitter.com/brunolemos/status/1087456685080358918', job: 'Software Engineer', }, { text: `this would’ve been impossible without the hard work from everyone at @pmndrs, zustand, r3f, react-spring, and obviously @clementroche_‘s incredible talent. but it was no easy task to learn all the tricks we now know.. and thinking about all the stuff we still don’t `, name: 'arzafran', img: 'arzafran.png', handle: '@arzafran', tweetUrl: 'https://twitter.com/arzafran/status/1476169639973560334', job: 'Partner at Studio Freight', }, { text: `So, it turns out you can mix HTML and WebGL. And with react-spring you can animate both.`, name: 'Varun Vachhar', img: 'varun_vachhar.jpeg', handle: '@winkerVSbecks', tweetUrl: 'https://twitter.com/winkerVSbecks/status/1419032183952576515', job: 'Software Engineer', }, { text: `The game being game, I have a lot of animations. I started using what is proposed by tailwind but it is not good enough for 2020. I ended moving to react spring. The learning curve is steeper than what I had expect. But it's a delightful experience afterwards.`, name: 'Alex Stanislawski', img: 'alex_stanislawski.jpeg', handle: '@bobylito', tweetUrl: 'https://twitter.com/bobylito/status/1337144280171819018', job: 'Software Engineer', }, ] export const NAV_TILES: Tile[] = [ { href: '/docs/getting-started', label: 'Getting Started', description: 'Learn about how to use react-spring with step by step explanations', }, { href: '/docs/guides', label: 'Guides & Tutorials', description: 'Read up on step-by-step tutorials for common use cases exploring our different hooks', comingSoon: true, }, { href: '/examples', label: 'Examples', description: 'Be inspired by exploring all our examples, why not contribute your own?', }, ] export const COMMUNITY_TILES: Tile[] = [ { label: 'Discord', description: 'Ask questions, share tips & tricks', href: 'https://discord.gg/AXfNsGx64f', isExternal: true, Icon: DiscordLogo, }, { label: 'Github', description: 'Report issues, submit ideas and contribute', isExternal: true, href: 'https://www.github.com/pmndrs/react-spring', Icon: GithubLogo, }, { label: 'Twitter', description: 'Keep up to date with all things Poimandres', isExternal: true, href: 'https://www.twitter.com/pmndrs', Icon: TwitterLogo, }, ] export const TOOL_TILES = [ { label: 'react-three-fiber', description: 'A React renderer for Three.js', href: 'https://www.github.com/pmndrs/react-three-fiber', isExternal: true, Icon: '⚡️', }, { label: '@use-gesture', description: 'Bread n butter utility for component-tied mouse/touch gestures in React and Vanilla Javascript.', href: 'https://github.com/pmndrs/use-gesture', isExternal: true, Icon: '🤙', }, { label: 'leva', description: 'React-first components GUI', href: 'https://www.github.com/pmndrs/leva', isExternal: true, Icon: '🌋', }, { label: 'zustand', description: 'Bear necessities for state management in React', href: 'https://www.github.com/pmndrs/zustand', isExternal: true, Icon: '🐻', }, ] export const configData: CellData[][] = [ ['mass', 'number', '1'], ['tension', 'number', '170'], ['friction', 'number', '26'], [ { label: 'bounce', content: (

When above zero, the spring will bounce instead of overshooting when exceeding its goal value.

), }, 'number', null, ], [ { label: 'clamp', content: (

When true, stops the spring once it overshoots its boundaries.

), }, 'boolean', 'false', ], [ { label: 'precision', content: (

How close to the goal the animated value gets before we consider it to be "done", see precision pifalls for more information.

), }, 'number', '0.01', ], [ { label: 'round', content: (

While animating, round to the nearest multiple of this number. The from and to values are never rounded, as well as any value passed to the set method of an animated value.

), }, 'boolean', null, ], [ { label: 'frequency', content: (

The natural frequency (in seconds), which dictates the number of bounces per second when no damping exists. When defined, tension is derived from this, and friction{' '} is derived from tension and damping.

), }, 'number', null, ], [ { label: 'damping', content: (

The damping ratio, which dictates how the spring slows down. Only works when frequency is defined.

), }, 'number', '1', ], ['velocity', 'number', '0'], [ { label: 'restVelocity', content: (

The smallest velocity before the animation is considered to be "not moving". When undefined, precision is used instead.

), }, 'number', null, ], [ 'decay', { label: 'number | boolean', content: (

If true, default value is 0.998.

), }, 'false', ], [ { label: 'duration', content: (

Switches to duration based animation. Value should be indicated in milliseconds.

), }, 'number', null, ], [ 'easing', { label: 'function', content: {`(t: number) => number`}, }, 't => t', ], [ { label: 'progress', content: (

Decides how far into the easing function to start from. The duration itself is unaffected.

), }, 'number', '0', ], ] export const easingData: CellData[][] = [ ['easeInBack', 'easeOutBack', 'easeInOutBack'], ['easeInBounce', 'easeOutBounce', 'easeOutBounce'], ['easeInCirc', 'easeOutCirc', 'easeOutCirc'], ['easeInCubic', 'easeOutCubic', 'easeOutCubic'], ['easeInElastic', 'easeOutElastic', 'easeOutElastic'], ['easeInExpo', 'easeOutExpo', 'easeOutExpo'], ['easeInQuad', 'easeOutQuad', 'easeOutQuad'], ['easeInQuart', 'easeOutQuart', 'easeOutQuart'], ['easeInQuint', 'easeOutQuint', 'easeOutQuint'], ['easeInSine', 'easeOutSine', 'easeOutSine'], ] const EVENTS_CELL: CellData[] = [ { label: 'events', content: (

This is not a prop but rather a collection, see{' '} Events for more information.

), }, 'function', null, ] const REF_CELL: CellData[] = [ { label: 'ref', content: (

Used to access the imperative API. Animations never auto-start when{' '} ref is defined.

), }, 'SpringRef', null, ] const ToContent = (

The to prop, is very versatile, for more information checkout out Async Animations.

) export const DEFAULT_CONFIG_DATA: CellData[][] = [ ['from', 'object', null], [ { label: 'to', content: ToContent, }, { label: 'object | object[] | function', content: ( {`(next: (props?: object) => Promise, cancel: () => void) => Promise`} ), }, null, ], [ 'loop', { label: 'boolean | object | function', content: {`() => boolean`}, }, null, ], [ { label: 'delay', content:

Delay in ms before the animation starts.

, }, { label: 'number | function', content: {`(key: string) => number`}, }, null, ], [ { label: 'immediate', content:

Prevents the animation if true.

, }, { label: 'boolean | function', content: {`(key: string) => boolean`}, }, null, ], [ { label: 'reset', content: (

Resets the spring so it plays from the start again when true.

), }, 'boolean', null, ], [ { label: 'reverse', content: (

Reverse the to and from prop so that{' '} to is the initial starting state.

), }, 'boolean', null, ], [ { label: 'pause', content:

Pause an animation at it's current point.

, }, 'boolean', null, ], [ 'cancel', { label: 'boolean | string | string[] | function', content: {`(key: string) => boolean`}, }, null, ], REF_CELL, [ { label: 'config', content: (

Spring config (mass / tension etc.), see{' '} Config for more information.

), }, { label: 'object | function', content: {`(key: string) => SpringConfig`}, }, { label: 'object', content: {`{ mass: 1, tension: 170, friction: 26 }`}, }, ], EVENTS_CELL, ] export const USE_SCROLL_CONFIG_DATA: CellData[][] = [ ['container', 'React.MutableRefObject', null], ...DEFAULT_CONFIG_DATA.filter( row => row[0] !== 'from' && typeof row[0] === 'object' && row[0]?.label !== 'to' ), ] export const USE_RESIZE_CONFIG_DATA: CellData[][] = [ ['container', 'React.MutableRefObject', null], ...DEFAULT_CONFIG_DATA.filter( row => row[0] !== 'from' && typeof row[0] === 'object' && row[0]?.label !== 'to' ), ] export const USESPRINGVALUE_CONFIG_DATA: CellData[][] = [ [ { label: 'to', content: ToContent, }, { label: 'object | object[] | function', content: ( {`(next: (props?: object) => Promise, cancel: () => void) => Promise`} ), }, null, ], [ 'loop', { label: 'boolean | object | function', content: {`() => boolean`}, }, null, ], [ { label: 'delay', content:

Delay in ms before the animation starts.

, }, { label: 'number | function', content: {`(key: string) => number`}, }, null, ], [ { label: 'immediate', content: (

Prevents the animation if true, applying the `to` styles immediately.

), }, { label: 'boolean | function', content: {`(key: string) => boolean`}, }, null, ], [ { label: 'reset', content: (

Resets the spring so it plays from the start again when true.

), }, 'boolean', null, ], [ { label: 'reverse', content: (

Reverse the to and from prop so that{' '} to is the initial starting state.

), }, 'boolean', null, ], [ { label: 'pause', content:

Pause an animation at it's current point.

, }, 'boolean', null, ], [ 'cancel', { label: 'boolean | string | string[] | function', content: {`(key: string) => boolean`}, }, null, ], [ { label: 'config', content: (

Spring config (mass / tension etc.), see{' '} Config for more information.

), }, { label: 'object | function', content: {`(key: string) => SpringConfig`}, }, { label: 'object', content: {`{ mass: 1, tension: 170, friction: 26 }`}, }, ], EVENTS_CELL, ] export const TRANSITION_CONFIG_DATA: CellData[][] = [ [ 'from', { label: 'object | function', content: {`(item: Item, index: number) => object`}, }, null, ], [ 'initial', { label: 'object | function', content: {`(item: Item, index: number) => object`}, }, null, ], [ { label: 'enter', content: (

The enter prop is used to pass styles to the animation when the transition is entering.

), }, { label: 'object | object[] | function', content: ( {`(item: Item, index: number) => object | object[] | (next: (props?: object) => Promise, cancel: () => void) => Promise`} ), }, null, ], [ { label: 'update', content: (

The update prop is used to pass styles to the animation when the transition is updating.

), }, { label: 'object | object[] | function', content: ( {`(item: Item, index: number) => object | object[] | (next: (props?: object) => Promise, cancel: () => void) => Promise`} ), }, null, ], [ { label: 'leave', content: (

The leave prop is used to pass styles to the animation when the transition is leaving.

), }, { label: 'object | object[] | function', content: ( {`(item: Item, index: number) => object | object[] | (next: (props?: object) => Promise, cancel: () => void) => Promise`} ), }, null, ], [ { label: 'keys', content: (

Keys are automatically created so this prop is typically not required

), }, { label: 'Array | function | null', content: {`(item: Item) => string | number`}, }, null, ], [ 'sort', { label: 'function', content: {`(a: Item, b: Item) => number`}, }, null, ], ['trail', 'number', '0'], ['exitBeforeEnter', 'boolean', 'false'], [ { label: 'expires', content: ( <>

When true or {'<= 0'}, each item is unmounted immediately after its `leave` animation is finished.


When false, items are never unmounted.


When {'> 0'}, this prop is used in a{' '} setTimeout call that forces a rerender if the component that called useTransition doesn't rerender on its own after an item's leave animation is finished.

), }, { label: 'boolean | number | function', content: {`(item: Item) => boolean | number`}, }, 'true', ], REF_CELL, [ { label: 'config', content: (

Spring config (mass / tension etc.), see{' '} Config for more information.

), }, { label: 'object | function', content: ( {`(item: Item, index: number, state: TransitionPhase) => SpringConfig`} ), }, { label: 'object', content: {`{ mass: 1, tension: 170, friction: 26 }`}, }, ], EVENTS_CELL, ] export const SPRINGVALUE_PROPERTIES_DATA: CellData[][] = [ ['animation', 'Animation', 'Animation'], [ { label: 'defaultProps', content:

Some props have customizable default values.

, }, 'SpringConfig', '{}', ], ['goal', 'any', null], [ { label: 'hasAnimated', content:

When true, this value has been animated at least once.

, }, 'boolean', 'false', ], [ { label: 'idle', content:

Equals true when not advancing on each frame.

, }, 'boolean', null, ], [ { label: 'isAnimating', content:

When true, this value has been animated at least once.

, }, 'boolean', 'false', ], [ { label: 'isDelayed', content:

When true the value has delay before it can animate.

, }, 'boolean', 'false', ], [ { label: 'isPaused', content:

When true, all current and future animations are paused.

, }, 'boolean', 'false', ], [ { label: 'key', content: (

The property name used when `to` or `from` is an object. Useful when debugging too.

), }, 'string | undefined', 'undefined', ], [ { label: 'queue', content:

The queue of pending props

, }, 'SpringUpdate[]', '[]', ], ['velocity', 'number | number[]', null], ] export const CONTROLLER_PROPERTIES_DATA: CellData[][] = [ [ { label: 'idle', content: (

The animated values. This is what you pass to your{' '} animated component.

), }, 'SpringValues', '{}', ], ['item', 'any', null], [ { label: 'queue', content: (

The queue of props passed to the update method.

), }, 'ControllerQueue', '[]', ], [ { label: 'ref', content: (

The injected ref. When defined, render-based updates are pushed onto the queue instead of being auto-started.

), }, 'SpringRef', null, ], [ { label: 'springs', content: (

The animated values. This is what you pass to your{' '} animated component.

), }, 'SpringValues', '{}', ], ] export const INTERPOLATONS_DATA: CellData[][] = [ [ 'extrapolateLeft', { label: 'string', content: {`"identity" | "clamp" | "extend"`}, }, 'extend', ], [ 'extrapolateRight', { label: 'string', content: {`"identity" | "clamp" | "extend"`}, }, 'extend', ], [ 'extrapolate', { label: 'string', content: {`"identity" | "clamp" | "extend"`}, }, 'extend', ], [ { label: 'range', content:

Array of input ranges

, }, 'number[]', '[0,1]', ], [ { label: 'output', content:

Array of mapped output ranges

, }, 'number[]', null, ], [ { label: 'map', content:

Value filter applied to input value

, }, { label: 'function', content: {`(value: number) => number`}, }, 'null', ], ] export const PARALLAX_CONFIG_DATA: CellData[][] = [ [ { label: 'pages', content: (

Determines the total space of the inner content where each page takes 100% of the visible container.

), }, 'number', null, ], [ { label: 'config', content: (

Spring config (mass / tension etc.), see{' '} Config for more information.

), }, { label: 'object | function', content: {`(key: string) => SpringConfig`}, }, { label: 'object', content: {`{ mass: 1, tension: 280, friction: 60 }`}, }, ], ['enabled', 'boolean', 'true'], ['horizontal', 'boolean', 'false'], ['innerStyle', 'CSSProperties', null], ] export const PARALLAX_LAYER_CONFIG_DATA: CellData[][] = [ ['horizontal', 'boolean', null], [ { label: 'factor', content:

Size of a page, (1=100%, 1.5=1 and 1/2, ...)

, }, 'number', '1', ], [ { label: 'offset', content: (

Determines where the layer will be at when scrolled to (0=start, 1=1st page, ...)

), }, 'number', '0', ], [ { label: 'speed', content: (

Shifts the layer in accordance to its offset, values can be positive or negative

), }, 'number', '0', ], [ { label: 'sticky', content: (

Layer will be sticky between these two offsets, all other props are ignored

), }, { label: 'StickyConfig', content: {`{ start?: number; end?: number } | undefined`}, }, null, ], ] export const USE_INVIEW_INTERSECTION_ARGS: CellData[][] = [ ['amount', '"any" | "all" | number | number[]', 'any'], ['root', 'React.MutableRefObject', null], ['rootMargin', 'string', null], ['once', 'boolean', 'false'], ]