@@ -33,12 +33,6 @@ const Color = {
3333 boxes : [ '#0075ff' , '#ff002e' , '#00ba6c' , '#eb00ff' , '#ffb800' , '#09d3c7' ] ,
3434}
3535
36- const checkeredBackground = ( color : string ) : CSSProperties => ( {
37- backgroundImage : `linear-gradient(45deg, ${ color } 25%, transparent 25%), linear-gradient(-45deg, ${ color } 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${ color } 75%), linear-gradient(-45deg, transparent 75%, ${ color } 75%)` ,
38- backgroundSize : '20px 20px' ,
39- backgroundPosition : '0 0, 0 10px, 10px -10px, -10px 0px' ,
40- } )
41-
4236const headingStyles = ( as : 'h1' | 'h2' | 'h3' ) : CSSProperties => ( {
4337 margin : 0 ,
4438 fontSize : as === 'h1' ? scale ( 36 ) : scale ( 24 ) ,
@@ -76,15 +70,14 @@ function Paragraph({ style, ...props }: JSX.IntrinsicElements['p']) {
7670
7771function Code ( { children } : { children : string } ) {
7872 return (
79- < Scroll >
73+ < Scroll overflowStyle = { { borderRadius : scale ( 20 ) } } >
8074 < div
8175 style = { {
8276 display : 'flex' ,
8377 flex : 1 ,
8478 flexDirection : 'column' ,
8579 padding : scale ( 20 ) ,
8680 background : Color . blue . ultralight ,
87- borderRadius : scale ( 20 ) ,
8881 fontFamily : 'monospace' ,
8982 whiteSpace : 'pre' ,
9083 fontSize : scale ( 16 ) ,
@@ -137,7 +130,7 @@ function DynamicContent({ children }) {
137130function animateHeight ( ) {
138131 const element = document . getElementById ( 'animated-box' )
139132 const startHeight = element . offsetHeight
140- let startTime = null
133+ let startTime = 0
141134 const increase = startHeight < 200
142135 const duration = 3000
143136 const targetHeight = increase ? 250 : 50
@@ -237,7 +230,18 @@ const MyGrid = () => (
237230 </Scroll>
238231)` } </ Code >
239232 < Heading as = "h2" > Examples</ Heading >
240- < Scroll style = { { maxWidth : 360 } } overflowStyle = { { gap : scale ( 10 ) } } >
233+ < Heading as = "h3" > Vertical & Horizontal </ Heading >
234+ < Scroll as = "main" style = { { maxHeight : 150 , maxWidth : 340 } } overflowStyle = { { gap : scale ( 10 ) , flexDirection : 'column' } } >
235+ { Array . from ( { length : 6 } ) . map ( ( _ , i ) => (
236+ < div style = { { display : 'flex' , gap : scale ( 10 ) } } key = { i } >
237+ { Array . from ( { length : 6 } ) . map ( ( _ , j ) => (
238+ < Box key = { j } />
239+ ) ) }
240+ </ div >
241+ ) ) }
242+ </ Scroll >
243+ < Heading as = "h3" > Horizontal</ Heading >
244+ < Scroll style = { { maxWidth : 340 } } overflowStyle = { { gap : scale ( 10 ) } } >
241245 < Box />
242246 < Box />
243247 < Box />
@@ -246,7 +250,7 @@ const MyGrid = () => (
246250 < Box />
247251 </ Scroll >
248252 < Heading as = "h3" > Vertical</ Heading >
249- < Scroll as = "main" style = { { maxHeight : 160 } } direction = "vertical" overflowStyle = { { gap : scale ( 10 ) , flexDirection : 'column' } } >
253+ < Scroll as = "main" style = { { maxHeight : 150 } } overflowStyle = { { gap : scale ( 10 ) , flexDirection : 'column' } } >
250254 < Box />
251255 < Box />
252256 < Box />
@@ -317,7 +321,7 @@ const MyGrid = () => (
317321 ) ) }
318322 </ Scroll >
319323 < Heading as = "h3" > Dynamic Content Size</ Heading >
320- < Scroll style = { { maxWidth : 360 } } overflowStyle = { { gap : scale ( 10 ) } } >
324+ < Scroll style = { { maxWidth : 340 } } overflowStyle = { { gap : scale ( 10 ) } } >
321325 < DynamicContent >
322326 { ( frame : number ) => (
323327 < >
@@ -333,7 +337,7 @@ const MyGrid = () => (
333337 ) }
334338 </ DynamicContent >
335339 </ Scroll >
336- < Scroll style = { { maxWidth : 360 } } overflowStyle = { { gap : scale ( 10 ) } } >
340+ < Scroll style = { { maxWidth : 340 } } overflowStyle = { { gap : scale ( 10 ) } } >
337341 < DynamicContent >
338342 { ( frame : number ) => (
339343 < >
@@ -351,7 +355,7 @@ const MyGrid = () => (
351355 ) }
352356 </ DynamicContent >
353357 </ Scroll >
354- < Scroll style = { { maxWidth : 360 } } >
358+ < Scroll style = { { maxWidth : 340 } } >
355359 < DynamicContent >
356360 { ( frame : number ) => (
357361 < div style = { { display : 'flex' , gap : scale ( 10 ) } } >
@@ -372,11 +376,7 @@ const MyGrid = () => (
372376 </ DynamicContent >
373377 </ Scroll >
374378 < Heading as = "h3" > Dynamic Vertical Content Size</ Heading >
375- < Scroll
376- style = { { height : 200 } }
377- direction = "vertical"
378- overflowStyle = { { gap : scale ( 10 ) , flexDirection : 'column' } }
379- >
379+ < Scroll style = { { height : 200 } } overflowStyle = { { gap : scale ( 10 ) , flexDirection : 'column' } } >
380380 < AddMoreContent />
381381 </ Scroll >
382382 < Heading as = "h2" > Configuration</ Heading >
@@ -411,27 +411,6 @@ const ResultingStructure = () => (
411411 </div>
412412 </div>
413413)` } </ Code >
414- < Heading as = "h2" > Development Playground</ Heading >
415- < Scroll style = { { maxWidth : 300 } } overflowStyle = { { gap : scale ( 10 ) } } >
416- < div
417- style = { {
418- width : 1000 ,
419- height : 50 ,
420- ...checkeredBackground ( Color . boxes [ 0 ] ) ,
421- flex : '0 0 auto' ,
422- } }
423- />
424- </ Scroll >
425- < Scroll direction = "vertical" style = { { maxHeight : 100 } } overflowStyle = { { gap : scale ( 20 ) } } >
426- < div
427- style = { {
428- width : 200 ,
429- height : 300 ,
430- ...checkeredBackground ( Color . boxes [ 1 ] ) ,
431- flex : '0 0 auto' ,
432- } }
433- />
434- </ Scroll >
435414 </ div >
436415 )
437416}
0 commit comments