forked from JasGH/react-spring-bottom-sheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple.tsx
72 lines (66 loc) · 2.02 KB
/
simple.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import type { NextPage } from 'next'
import { useEffect, useState } from 'react'
import Button from '../../docs/fixtures/Button'
import Code from '../../docs/fixtures/Code'
import Container from '../../docs/fixtures/Container'
import Expandable from '../../docs/fixtures/Expandable'
import Kbd from '../../docs/fixtures/Kbd'
import SheetContent from '../../docs/fixtures/SheetContent'
import { simple } from '../../docs/headings'
import MetaTags from '../../docs/MetaTags'
import { BottomSheet } from '../../src'
import type { GetStaticProps } from '../_app'
export { getStaticProps } from '../_app'
const SimpleFixturePage: NextPage<GetStaticProps> = ({
description,
homepage,
meta,
name,
}) => {
const [open, setOpen] = useState(false)
// Ensure it animates in when loaded
useEffect(() => {
setOpen(true)
}, [])
function onDismiss() {
setOpen(false)
}
return (
<>
<MetaTags
{...meta}
name={name}
description={description}
homepage={homepage}
title={simple}
/>
<Container>
<Button onClick={() => setOpen(true)}>Open</Button>
<BottomSheet
open={open}
onDismiss={onDismiss}
snapPoints={({ minHeight }) => minHeight}
>
<SheetContent>
<p>
Using <Code>onDismiss</Code> lets users close the sheet by swiping
it down, tapping on the backdrop or by hitting <Kbd>esc</Kbd> on
their keyboard.
</p>
<Expandable>
<div className="bg-gray-200 block rounded-md h-10 w-full my-10" />
<p>
The height adjustment is done automatically, it just works™!
</p>
<div className="bg-gray-200 block rounded-md h-10 w-full my-10" />
</Expandable>
<Button onClick={onDismiss} className="w-full">
Dismiss
</Button>
</SheetContent>
</BottomSheet>
</Container>
</>
)
}
export default SimpleFixturePage