Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create infinite autofill component #305

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tworrisb
Copy link

No description provided.

# InfiniteAutoFill

Uses the AutoFill to repeat children to fill the parent element in given axis. In addition to that
it adds the children one more time to the end of the list. This can be useful for example marquee's.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it adds the children one more time to the end of the list. This can be useful for example marquee's.
it adds the children one more time to the end of the list. This can be useful for example marquees or infinite carousels.

function DemoComponent() {
return (
<div style={{ height: 1000, outline: '1px solid black' }}>
<InfiniteAutoFill>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing y axis.

/**
* Repeats children to fill the parent element in given axis.
*/
export function InfiniteAutoFill({ children, axis = 'x' }: InfiniteAutoFillProps): ReactElement {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to "copy" the default here? Making it undefined is enough IMO.

ref: RefCallback<unknown>;
};

type InfiniteAutoFillProps = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use the AutoFillProps instead of copying them, so this will be in sync if the others are updated.

ref: RefCallback<unknown>;
};

type InfiniteAutoFillProps = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type InfiniteAutoFillProps = {
type InfiniteAutoFillProps = ComponentProps<typeof AutoFill>;

@tworrisb tworrisb force-pushed the feature/create-infinite-autofill-component branch 2 times, most recently from 66510e9 to 09c9721 Compare January 29, 2024 14:57
@tworrisb tworrisb force-pushed the feature/create-infinite-autofill-component branch from 09c9721 to 168e305 Compare January 29, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants