1
1
import * as React from 'react'
2
- import Head from 'next/head'
3
2
import Link from 'next/link'
4
3
import { AnimatePresence , motion } from 'framer-motion'
5
4
import { Menu } from '../../src/components/menu/menu'
@@ -9,74 +8,62 @@ import { PropsOf } from '../../src/types'
9
8
10
9
export default function Home ( ) {
11
10
return (
12
- < >
13
- < Head >
14
- < title > Menu with framer motion - Playground</ title >
15
- </ Head >
11
+ < div className = "flex justify-center w-screen h-full p-12 bg-gray-50" >
12
+ < div className = "relative inline-block text-left" >
13
+ < Menu >
14
+ { ( { open } ) => (
15
+ < >
16
+ < span className = "rounded-md shadow-sm" >
17
+ < Menu . Button className = "inline-flex justify-center w-full px-4 py-2 text-sm font-medium leading-5 text-gray-700 transition duration-150 ease-in-out bg-white border border-gray-300 rounded-md hover:text-gray-500 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-50 active:text-gray-800" >
18
+ < span > Options</ span >
19
+ < svg className = "w-5 h-5 ml-2 -mr-1" viewBox = "0 0 20 20" fill = "currentColor" >
20
+ < path
21
+ fillRule = "evenodd"
22
+ d = "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
23
+ clipRule = "evenodd"
24
+ />
25
+ </ svg >
26
+ </ Menu . Button >
27
+ </ span >
16
28
17
- < div className = "flex justify-center w-screen h-full p-12 bg-gray-50" >
18
- < Dropdown />
19
- </ div >
20
- </ >
21
- )
22
- }
29
+ < AnimatePresence >
30
+ { open && (
31
+ < Menu . Items
32
+ static
33
+ as = { motion . div }
34
+ initial = { { opacity : 0 , y : 0 } }
35
+ animate = { { opacity : 1 , y : '0.5rem' } }
36
+ exit = { { opacity : 0 , y : 0 } }
37
+ className = "absolute right-0 w-56 bg-white border border-gray-200 divide-y divide-gray-100 rounded-md shadow-lg outline-none opacity-0"
38
+ >
39
+ < div className = "px-4 py-3" >
40
+ < p className = "text-sm leading-5" > Signed in as</ p >
41
+ < p className = "text-sm font-medium leading-5 text-gray-900 truncate" >
42
+
43
+ </ p >
44
+ </ div >
23
45
24
- function Dropdown ( ) {
25
- return (
26
- < div className = "relative inline-block text-left" >
27
- < Menu >
28
- { ( { open } ) => (
29
- < >
30
- < span className = "rounded-md shadow-sm" >
31
- < Menu . Button className = "inline-flex justify-center w-full px-4 py-2 text-sm font-medium leading-5 text-gray-700 transition duration-150 ease-in-out bg-white border border-gray-300 rounded-md hover:text-gray-500 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-50 active:text-gray-800" >
32
- < span > Options</ span >
33
- < svg className = "w-5 h-5 ml-2 -mr-1" viewBox = "0 0 20 20" fill = "currentColor" >
34
- < path
35
- fillRule = "evenodd"
36
- d = "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
37
- clipRule = "evenodd"
38
- />
39
- </ svg >
40
- </ Menu . Button >
41
- </ span >
46
+ < div className = "py-1" >
47
+ < Item href = "#account-settings" > Account settings</ Item >
48
+ < Item as = { NextLink } href = "#support" >
49
+ Support
50
+ </ Item >
51
+ < Item href = "#new-feature" disabled >
52
+ New feature (soon)
53
+ </ Item >
54
+ < Item href = "#license" > License</ Item >
55
+ </ div >
42
56
43
- < AnimatePresence >
44
- { open && (
45
- < Menu . Items
46
- static
47
- as = { motion . div }
48
- initial = { { opacity : 0 , y : 0 } }
49
- animate = { { opacity : 1 , y : '0.5rem' } }
50
- exit = { { opacity : 0 , y : 0 } }
51
- className = "absolute right-0 w-56 bg-white border border-gray-200 divide-y divide-gray-100 rounded-md shadow-lg outline-none opacity-0"
52
- >
53
- < div className = "px-4 py-3" >
54
- < p className = "text-sm leading-5" > Signed in as</ p >
55
- < p className = "text-sm font-medium leading-5 text-gray-900 truncate" >
56
-
57
- </ p >
58
- </ div >
59
-
60
- < div className = "py-1" >
61
- < Item href = "#account-settings" > Account settings</ Item >
62
- < Item as = { NextLink } href = "#support" >
63
- Support
64
- </ Item >
65
- < Item href = "#new-feature" disabled >
66
- New feature (soon)
67
- </ Item >
68
- < Item href = "#license" > License</ Item >
69
- </ div >
70
-
71
- < div className = "py-1" >
72
- < Item as = { SignOutButton } />
73
- </ div >
74
- </ Menu . Items >
75
- ) }
76
- </ AnimatePresence >
77
- </ >
78
- ) }
79
- </ Menu >
57
+ < div className = "py-1" >
58
+ < Item as = { SignOutButton } />
59
+ </ div >
60
+ </ Menu . Items >
61
+ ) }
62
+ </ AnimatePresence >
63
+ </ >
64
+ ) }
65
+ </ Menu >
66
+ </ div >
80
67
</ div >
81
68
)
82
69
}
0 commit comments