-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: vertical carousel option (#948)
* feat: add direction and maxSlideHeight props for adjusting the carousel to be vertical why: 'direction' prop for changing the direction, 'maxSlideHeight' for limiting the container of the carousel how: add these two props and change styles accordingly * chore: add directionSig to context * docs: add the vertical-direction section to docs why: so users could see that it is possible to make it vertical * feat: add the scrollable option for the vertical carousel how: check for see if it is a vertical carousel and if so adjust the scrolling direction in the scroller component * refactor: make the scroller component checks cleaner * docs: add the needed props for vertical carousel under API in docs * test: add test for swiping up vertical carousel * chore: add changeset file * chore: remove changeset file why: no need here * fix: some minor fixes * docs: place the vertical direction section in right way * fix: change the slide offsetTop of slide in vertical carousel when touch event triggered why: the index was not updated as needed * test: add touch screen test for swiping vertical carousel * test: add touchEvent tests for vertical carousel what: one test for swiping and one for check that the slide index updates
- Loading branch information
Showing
8 changed files
with
230 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
apps/website/src/routes/docs/headless/carousel/examples/vertical-direction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { component$, useStyles$ } from '@builder.io/qwik'; | ||
import { Carousel } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
useStyles$(styles); | ||
|
||
const colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'pink']; | ||
|
||
return ( | ||
<Carousel.Root class="carousel-root" gap={30} direction="column" maxSlideHeight={160}> | ||
<div class="carousel-buttons"> | ||
<Carousel.Previous>Prev</Carousel.Previous> | ||
<Carousel.Next>Next</Carousel.Next> | ||
</div> | ||
<Carousel.Scroller class="carousel-scroller"> | ||
{colors.map((color) => ( | ||
<Carousel.Slide key={color} class="carousel-slide"> | ||
{color} | ||
</Carousel.Slide> | ||
))} | ||
</Carousel.Scroller> | ||
</Carousel.Root> | ||
); | ||
}); | ||
|
||
// internal | ||
import styles from './carousel.css?inline'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.