-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathApp.jsx
151 lines (130 loc) · 4.5 KB
/
App.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import * as React from 'react'
import { Link, Route } from 'wouter'
import { Globals } from '@react-spring/web'
import styles from './styles.module.css'
import AnimatingAuto from './sandboxes/animating-auto/src/App'
import Card from './sandboxes/card/src/App'
import CardsStack from './sandboxes/cards-stack/src/App'
import Chain from './sandboxes/chain/src/App'
import CssGradients from './sandboxes/css-gradients/src/App'
import CssKeyframes from './sandboxes/css-keyframes/src/App'
import CssVariables from './sandboxes/css-variables/src/App'
import DecayRocket from './sandboxes/rocket-decay/src/App'
import DraggableList from './sandboxes/draggable-list/src/App'
import ExitBeforeEnter from './sandboxes/exit-before-enter/src/App'
import FlipCard from './sandboxes/flip-card/src/App'
import FloatingButton from './sandboxes/floating-button/src/App'
import GooBlobs from './sandboxes/goo-blobs/src/App'
import ImageFade from './sandboxes/image-fade/src/App'
import MacOSDock from './sandboxes/macos-dock/src/App'
import ListReordering from './sandboxes/list-reordering/src/App'
import Masonry from './sandboxes/masonry/src/App'
import MultiStageTransition from './sandboxes/multistage-transition/src/App'
import NotificationHub from './sandboxes/notification-hub/src/App'
import Noise from './sandboxes/noise/src/App'
import Parallax from './sandboxes/parallax/src/App'
import ParallaxVert from './sandboxes/parallax-vert/src/App'
import ParallaxSticky from './sandboxes/parallax-sticky/src/App'
import PopupModal from './sandboxes/popup-modal/src/App'
import ScrollingWave from './sandboxes/scrolling-wave/src/App'
import SimpleTransition from './sandboxes/simple-transition/src/App'
import Slide from './sandboxes/slide/src/App'
import SvgFilter from './sandboxes/svg-filter/src/App'
import SpringBoxes from './sandboxes/springy-boxes/src/App'
import SmileGrid from './sandboxes/smile-grid/src/App'
import Trail from './sandboxes/trail/src/App'
import Tree from './sandboxes/tree/src/App'
import Viewpager from './sandboxes/viewpager/src/App'
import WebGlSwitch from './sandboxes/webgl-switch/src/App'
import Wordle from './sandboxes/wordle/src/App'
Globals.assign({
frameLoop: 'always',
})
const links = {
'animating-auto': AnimatingAuto,
card: Card,
'cards-stack': CardsStack,
chain: Chain,
'css-gradients': CssGradients,
'css-keyframes': CssKeyframes,
'css-variables': CssVariables,
'draggable-list': DraggableList,
'exit-before-enter': ExitBeforeEnter,
'flip-card': FlipCard,
'floating-button': FloatingButton,
'goo-blobs': GooBlobs,
'image-fade': ImageFade,
'list-reordering': ListReordering,
'macos-dock': MacOSDock,
masonry: Masonry,
'multistage-transition': MultiStageTransition,
noise: Noise,
'notification-hub': NotificationHub,
parallax: Parallax,
'parallax-sticky': ParallaxSticky,
'parallax-vert': ParallaxVert,
'popup-modal': PopupModal,
'rocket-decay': DecayRocket,
'scrolling-wave': ScrollingWave,
'simple-transition': SimpleTransition,
slide: Slide,
'smile-grid': SmileGrid,
'springy-boxes': SpringBoxes,
'svg-filter': SvgFilter,
trail: Trail,
tree: Tree,
viewpager: Viewpager,
'webgl-switch': WebGlSwitch,
wordle: Wordle,
}
const Example = ({ link }) => {
const Component = links[link]
return (
<>
<Link href="/">
{/*eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a className={styles.back}>← Back</a>
</Link>
<Component />
</>
)
}
export default function App() {
return (
<>
<Route path="/">
<div className={styles.page}>
<h1>React Spring demos</h1>
<h2>Sandboxes</h2>
<ul className={styles.linkList}>
{Object.keys(links).map(link => (
<li key={link}>
<DemoCard link={link}>{link}</DemoCard>
</li>
))}
</ul>
</div>
</Route>
<Route path="/:link">{params => <Example link={params.link} />}</Route>
</>
)
}
const DemoCard = ({ children, link }) => {
return (
<Link key={link} href={`/${link}`}>
<a>
<figure className={styles.card}>
<div className={styles['image-container']}>
<img
src={`https://raw.githubusercontent.com/pmndrs/react-spring/main/demo/src/sandboxes/${link}/thumbnail.png`}
placeholder="empty"
loading="lazy"
alt={children}
/>
</div>
<figcaption className={styles.title}>{children}</figcaption>
</figure>
</a>
</Link>
)
}