Skip to content

Commit

Permalink
Simplify content height example
Browse files Browse the repository at this point in the history
  • Loading branch information
Temzasse committed Oct 27, 2024
1 parent f2fb875 commit 47fc296
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions example/components/ContentHeight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,24 @@ export function ContentHeight() {
<Sheet.Container layout>
<Sheet.Header />

<Sheet.Content>
<Sheet.Content layout="position">
<Sheet.Scroller>
<motion.div layout="position">
<BoxList>
<Button onClick={() => snapTo(0)}>Snap to top</Button>
<Button onClick={() => snapTo(1)}>Snap to bottom</Button>
<Button onClick={() => setBoxes((prev) => prev + 1)}>
Add box
</Button>
<Button
onClick={() => setBoxes((prev) => Math.max(0, prev - 1))}
>
Remove box
</Button>
<BoxList>
<Button onClick={() => snapTo(0)}>Snap to top</Button>
<Button onClick={() => snapTo(1)}>Snap to bottom</Button>
<Button onClick={() => setBoxes((prev) => prev + 1)}>
Add box
</Button>
<Button
onClick={() => setBoxes((prev) => Math.max(0, prev - 1))}
>
Remove box
</Button>

{Array.from({ length: boxes }).map((_, i) => (
<Box key={i}>{i}</Box>
))}
</BoxList>
</motion.div>
{Array.from({ length: boxes }).map((_, i) => (
<Box key={i}>{i}</Box>
))}
</BoxList>
</Sheet.Scroller>
</Sheet.Content>
</Sheet.Container>
Expand Down

0 comments on commit 47fc296

Please sign in to comment.