@@ -106,31 +106,33 @@ function Screenshots({ lean, rich }: { lean?: string; rich?: string }) {
106
106
function Axis ( { cost, rich } : { cost ?: string ; rich ?: string } ) {
107
107
return (
108
108
< >
109
- < div
110
- className = "absolute bottom-2 left-2 right-3 h-0.5 bg-zinc-700"
111
- style = { { translate : "0 50%" } }
112
- />
113
- < div
114
- className = "border-zinc-700 absolute right-2 bottom-2"
115
- style = { {
116
- width : 0 ,
117
- height : 0 ,
118
- borderTop : "5px solid transparent" ,
119
- borderBottom : "5px solid transparent" ,
120
- borderLeftWidth : "6px" ,
121
- translate : "0 50%" ,
122
- } }
123
- />
124
- < div className = "absolute bottom-3 right-2 text-xs text-zinc-500" >
125
- Richness
109
+ < div className = { cn ( "transition-all" , rich ) } >
110
+ < div
111
+ className = "absolute bottom-2 left-2 right-3 h-0.5 bg-zinc-100"
112
+ style = { { translate : "0 50%" } }
113
+ />
114
+ < div
115
+ className = "border-zinc-100 absolute right-2 bottom-2"
116
+ style = { {
117
+ width : 0 ,
118
+ height : 0 ,
119
+ borderTop : "5px solid transparent" ,
120
+ borderBottom : "5px solid transparent" ,
121
+ borderLeftWidth : "6px" ,
122
+ translate : "0 50%" ,
123
+ } }
124
+ />
125
+ < div className = "absolute bottom-3 right-2 text-sm text-zinc-100" >
126
+ Richness
127
+ </ div >
126
128
</ div >
127
129
< div className = { cn ( "transition-all" , cost ) } >
128
130
< div
129
- className = "absolute top-3 left-2 bottom-2 w-0.5 bg-zinc-700 "
131
+ className = "absolute top-3 left-2 bottom-2 w-0.5 bg-zinc-100 "
130
132
style = { { translate : "-50% 0" } }
131
133
/>
132
134
< div
133
- className = "border-zinc-700 absolute top-2 left-2"
135
+ className = "border-zinc-100 absolute top-2 left-2"
134
136
style = { {
135
137
width : 0 ,
136
138
height : 0 ,
@@ -141,7 +143,7 @@ function Axis({ cost, rich }: { cost?: string; rich?: string }) {
141
143
translate : "-50% 0" ,
142
144
} }
143
145
/>
144
- < div className = "absolute top-1 left-5 text-xs text-zinc-500 " > Cost</ div >
146
+ < div className = "absolute top-1 left-5 text-sm text-zinc-100 " > Cost</ div >
145
147
</ div >
146
148
</ >
147
149
)
@@ -216,42 +218,85 @@ export function Layout(props: unknown) {
216
218
const { steps } = parseProps ( props , Block . extend ( { steps : z . array ( Block ) } ) )
217
219
return (
218
220
< >
219
- < div className = "md:hidden" > TODO: small screen</ div >
220
- < SelectionProvider
221
- className = "hidden md:flex gap-6 relative mb-[max(calc(100vh-788px),64px)]"
222
- rootMargin = { { top : 256 + 48 , height : 384 - 48 * 2 } }
223
- >
224
- < div className = "flex-1" >
221
+ < div className = "md:hidden" >
222
+ < SmallLayout steps = { steps } />
223
+ </ div >
224
+ < div className = "hidden md:block" >
225
+ < ScrollyLayout steps = { steps } />
226
+ </ div >
227
+ </ >
228
+ )
229
+ }
230
+
231
+ function SmallLayout ( {
232
+ steps,
233
+ } : {
234
+ steps : {
235
+ children ?: React . ReactNode
236
+ } [ ]
237
+ } ) {
238
+ return (
239
+ < div className = "flex flex-col gap-6" >
240
+ { steps . map ( ( step , i ) => (
241
+ < div key = { i } >
225
242
< div
226
- className = "top-64 sticky h-96 flex-1 rounded bg-[url(/dark-grid.svg)] dark:bg-[#e6edff05] bg-black flex items-center justify-center "
243
+ className = "h-96 w-[324px] max-w-full relative mx-auto bg-[url(/dark-grid.svg)] dark:bg-[#e6edff05] bg-black rounded "
227
244
style = { {
228
245
backgroundPosition : "center" ,
229
246
backgroundSize : "26px" ,
230
247
} }
231
248
>
232
- < Selection
233
- from = { steps . map ( ( step , i ) => (
234
- < Chart data = { data [ i ] } />
235
- ) ) }
236
- />
249
+ < Chart data = { data [ i ] } />
237
250
</ div >
251
+ { step . children }
238
252
</ div >
239
- < div className = "flex-1 min-w-0 flex flex-col" >
240
- { steps . map ( ( step , i ) => (
241
- < Selectable
242
- key = { i }
243
- index = { i }
244
- className = "h-96 data-[selected=true]:opacity-100 opacity-20 transition-opacity snap-start scroll-mt-64 [&>:first-child]:mt-0 flex items-center"
245
- selectOn = { [ "scroll" ] }
246
- >
247
- < div className = "[&>:first-child]:mt-0 [&>:last-child]:mb-0" >
248
- { step . children }
249
- </ div >
250
- </ Selectable >
251
- ) ) }
253
+ ) ) }
254
+ </ div >
255
+ )
256
+ }
257
+
258
+ function ScrollyLayout ( {
259
+ steps,
260
+ } : {
261
+ steps : {
262
+ children ?: React . ReactNode
263
+ } [ ]
264
+ } ) {
265
+ return (
266
+ < SelectionProvider
267
+ className = "hidden md:flex gap-6 relative mb-[max(calc(100vh-788px),64px)]"
268
+ rootMargin = { { top : 256 + 48 * 3 , height : 48 } }
269
+ >
270
+ < div className = "flex-1" >
271
+ < div
272
+ className = "top-64 sticky h-96 flex-1 rounded bg-[url(/dark-grid.svg)] dark:bg-[#e6edff05] bg-black flex items-center justify-center"
273
+ style = { {
274
+ backgroundPosition : "center" ,
275
+ backgroundSize : "26px" ,
276
+ } }
277
+ >
278
+ < Selection
279
+ from = { steps . map ( ( step , i ) => (
280
+ < Chart data = { data [ i ] } />
281
+ ) ) }
282
+ />
252
283
</ div >
253
- </ SelectionProvider >
254
- </ >
284
+ </ div >
285
+ < div className = "flex-1 min-w-0 flex flex-col" >
286
+ { steps . map ( ( step , i ) => (
287
+ < Selectable
288
+ key = { i }
289
+ index = { i }
290
+ className = "h-96 data-[selected=true]:opacity-100 opacity-20 transition-opacity scroll-mt-64 [&>:first-child]:mt-0 flex items-center " // snap-start
291
+ selectOn = { [ "scroll" ] }
292
+ >
293
+ < div className = "[&>:first-child]:mt-0 [&>:last-child]:mb-0 prose-h3:scroll-m-64" >
294
+ { step . children }
295
+ </ div >
296
+ </ Selectable >
297
+ ) ) }
298
+ </ div >
299
+ </ SelectionProvider >
255
300
)
256
301
}
257
302
0 commit comments