File tree Expand file tree Collapse file tree 4 files changed +8
-16
lines changed
Expand file tree Collapse file tree 4 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ Fills components vertically.
4848function DemoComponent() {
4949 return (
5050 <div style = { { height: 1000 , outline: ' 1px solid black' }} >
51- <AutoFill >
51+ <AutoFill axis = " y " >
5252 <div style = { { padding: 15 }} >
5353 <div style = { { width: 50 , outline: ' 1px solid red' }} >Child</div >
5454 </div >
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ type AutoFillChildrenProps = {
1818 ref : RefCallback < unknown > ;
1919} ;
2020
21- type AutoFillProps = {
21+ export type AutoFillProps = {
2222 children :
2323 | ReactElement < AutoFillChildrenProps >
2424 | ReadonlyArray < ReactElement < AutoFillChildrenProps > > ;
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ import * as stories from './InfiniteAutoFill.stories';
66# InfiniteAutoFill
77
88Uses the AutoFill to repeat children to fill the parent element in given axis. In addition to that
9- it adds the children one more time to the end of the list. This can be useful for example marquee's.
9+ it adds the children one more time to the end of the list. This can be useful for example marquees
10+ or infinite carousels.
1011
1112## Reference
1213
@@ -49,7 +50,7 @@ Fills components vertically + one extra.
4950function DemoComponent() {
5051 return (
5152 <div style = { { height: 1000 , outline: ' 1px solid black' }} >
52- <InfiniteAutoFill >
53+ <InfiniteAutoFill axis = " y " >
5354 <div style = { { padding: 15 }} >
5455 <div style = { { width: 50 , outline: ' 1px solid red' }} >Child</div >
5556 </div >
Original file line number Diff line number Diff line change 1- import { type ReactElement , type RefCallback } from 'react' ;
1+ import { type ComponentProps , type ReactElement } from 'react' ;
22import { AutoFill } from '../../index.js' ;
33
4- type InfiniteAutoFillChildrenProps = {
5- ref : RefCallback < unknown > ;
6- } ;
7-
8- type InfiniteAutoFillProps = {
9- children :
10- | ReactElement < InfiniteAutoFillChildrenProps >
11- | ReadonlyArray < ReactElement < InfiniteAutoFillChildrenProps > > ;
12- axis ?: 'x' | 'y' ;
13- } ;
4+ type InfiniteAutoFillProps = ComponentProps < typeof AutoFill > ;
145
156/**
167 * Repeats children to fill the parent element in given axis.
178 */
18- export function InfiniteAutoFill ( { children, axis = 'x' } : InfiniteAutoFillProps ) : ReactElement {
9+ export function InfiniteAutoFill ( { children, axis } : InfiniteAutoFillProps ) : ReactElement {
1910 return (
2011 < >
2112 < AutoFill axis = { axis } > { children } </ AutoFill >
You can’t perform that action at this time.
0 commit comments