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

Refactoring Carousel widget. #174

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Refactoring Carousel widget. #174

wants to merge 21 commits into from

Conversation

terabytesoftw
Copy link
Member

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

@terabytesoftw terabytesoftw added the status:code review The pull request needs review. label Nov 8, 2024
@terabytesoftw terabytesoftw marked this pull request as ready for review November 8, 2024 10:07
src/CarouselItem.php Outdated Show resolved Hide resolved
src/CarouselItem.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/CarouselItem.php Outdated Show resolved Hide resolved
src/Carousel.php Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
src/Carousel.php Outdated Show resolved Hide resolved
Comment on lines +514 to 518
$activeItems = array_filter($this->items, static fn (CarouselItem $item) => $item->isActive());

if (count($activeItems) > 1) {
throw new InvalidArgumentException('Only one carousel item can be active at a time.');
}
Copy link
Member

Choose a reason for hiding this comment

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

This check could be done inside of foreach.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it too, but i need to know before iterating if any element is active, otherwise i mark the first one as active, and there may be the possibility that any element is active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants