Skip to content

Commit

Permalink
[@mantine/carousel] Fix responsive slideSize values working differe…
Browse files Browse the repository at this point in the history
…ntly from other style props
  • Loading branch information
rtivital committed Jul 13, 2024
1 parent b9a10f9 commit 1a3af9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@mantine/carousel/src/Carousel.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

.slide {
position: relative;
flex: 0 0 var(--carousel-slide-size);
flex: 0 0 var(--carousel-slide-size, 100%);

.root:where([data-include-gap-in-size]) & {
&:where([data-orientation='vertical']) {
Expand Down
9 changes: 8 additions & 1 deletion packages/@mantine/carousel/src/Carousel.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ const slides = (
export function Usage() {
const [value, setValue] = useState(0);
const log = useCallback((index: any) => console.log({ value, index }), [value]);

return (
<div style={{ padding: 40, maxWidth: 500 }}>
<button type="button" onClick={() => setValue(Math.random())}>
random
</button>
<Carousel slideGap="md" height={200} withIndicators onSlideChange={log}>
<Carousel
slideGap="md"
slideSize={{ md: '50%' }}
height={200}
withIndicators
onSlideChange={log}
>
{slides}
</Carousel>
</div>
Expand Down

0 comments on commit 1a3af9f

Please sign in to comment.