@@ -20,7 +20,7 @@ function Nested({ onClose, level = 0 }) {
2020 return (
2121 < >
2222 < Dialog open = { true } onClose = { onClose } className = "fixed z-10 inset-0" >
23- { true && < Dialog . Overlay className = "fixed inset-0 bg-gray-500 opacity-25" /> }
23+ < Dialog . Overlay className = "fixed inset-0 bg-gray-500 opacity-25" />
2424 < div
2525 className = "z-10 fixed left-12 top-24 bg-white w-96 p-4"
2626 style = { {
@@ -69,8 +69,8 @@ export default function Home() {
6969 < button onClick = { ( ) => setNested ( true ) } > Show nested</ button >
7070 { nested && < Nested onClose = { ( ) => setNested ( false ) } /> }
7171
72- < Transition show = { isOpen } as = { Fragment } >
73- < Dialog open = { isOpen } onClose = { setIsOpen } static >
72+ < Transition show = { isOpen } as = { Fragment } afterLeave = { ( ) => console . log ( 'done' ) } >
73+ < Dialog onClose = { setIsOpen } >
7474 < div className = "fixed z-10 inset-0 overflow-y-auto" >
7575 < div className = "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" >
7676 < Transition . Child
@@ -136,96 +136,78 @@ export default function Home() {
136136 </ p >
137137 < div className = "relative inline-block text-left mt-10" >
138138 < Menu >
139- { ( { open } ) => (
140- < >
141- < span className = "rounded-md shadow-sm" >
142- < Menu . Button
143- ref = { trigger }
144- 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"
145- >
146- < span > Choose a reason</ span >
147- < svg
148- className = "w-5 h-5 ml-2 -mr-1"
149- viewBox = "0 0 20 20"
150- fill = "currentColor"
151- >
152- < path
153- fillRule = "evenodd"
154- 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"
155- clipRule = "evenodd"
156- />
157- </ svg >
158- </ Menu . Button >
159- </ span >
139+ < span className = "rounded-md shadow-sm" >
140+ < Menu . Button
141+ ref = { trigger }
142+ 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"
143+ >
144+ < span > Choose a reason</ span >
145+ < svg
146+ className = "w-5 h-5 ml-2 -mr-1"
147+ viewBox = "0 0 20 20"
148+ fill = "currentColor"
149+ >
150+ < path
151+ fillRule = "evenodd"
152+ 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"
153+ clipRule = "evenodd"
154+ />
155+ </ svg >
156+ </ Menu . Button >
157+ </ span >
160158
161- < Transition
162- show = { open }
163- enter = "transition duration-100 ease-out"
164- enterFrom = "transform scale-95 opacity-0"
165- enterTo = "transform scale-100 opacity-100"
166- leave = "transition duration-75 ease-out"
167- leaveFrom = "transform scale-100 opacity-100"
168- leaveTo = "transform scale-95 opacity-0"
159+ < Transition
160+ enter = "transition duration-300 ease-out"
161+ enterFrom = "transform scale-95 opacity-0"
162+ enterTo = "transform scale-100 opacity-100"
163+ leave = "transition duration-75 ease-out"
164+ leaveFrom = "transform scale-100 opacity-100"
165+ leaveTo = "transform scale-95 opacity-0"
166+ >
167+ < Portal >
168+ < Menu . Items
169+ ref = { container }
170+ className = "z-20 w-56 mt-2 origin-top-right bg-white border border-gray-200 divide-y divide-gray-100 rounded-md shadow-lg outline-none"
169171 >
170- < Portal >
171- < Menu . Items
172- ref = { container }
173- static
174- className = "z-20 w-56 mt-2 origin-top-right bg-white border border-gray-200 divide-y divide-gray-100 rounded-md shadow-lg outline-none"
175- >
176- < div className = "px-4 py-3" >
177- < p className = "text-sm leading-5" > Signed in as</ p >
178- < p className = "text-sm font-medium leading-5 text-gray-900 truncate" >
179- 180- </ p >
181- </ div >
172+ < div className = "px-4 py-3" >
173+ < p className = "text-sm leading-5" > Signed in as</ p >
174+ < p className = "text-sm font-medium leading-5 text-gray-900 truncate" >
175+ 176+ </ p >
177+ </ div >
182178
183- < div className = "py-1" >
184- < Menu . Item
185- as = "a"
186- href = "#account-settings"
187- className = { resolveClass }
188- >
189- Account settings
190- </ Menu . Item >
191- < Menu . Item
192- as = "a"
193- href = "#support"
194- className = { resolveClass }
195- >
196- Support
197- </ Menu . Item >
198- < Menu . Item
199- as = "a"
200- disabled
201- href = "#new-feature"
202- className = { resolveClass }
203- >
204- New feature (soon)
205- </ Menu . Item >
206- < Menu . Item
207- as = "a"
208- href = "#license"
209- className = { resolveClass }
210- >
211- License
212- </ Menu . Item >
213- </ div >
179+ < div className = "py-1" >
180+ < Menu . Item
181+ as = "a"
182+ href = "#account-settings"
183+ className = { resolveClass }
184+ >
185+ Account settings
186+ </ Menu . Item >
187+ < Menu . Item as = "a" href = "#support" className = { resolveClass } >
188+ Support
189+ </ Menu . Item >
190+ < Menu . Item
191+ as = "a"
192+ disabled
193+ href = "#new-feature"
194+ className = { resolveClass }
195+ >
196+ New feature (soon)
197+ </ Menu . Item >
198+ < Menu . Item as = "a" href = "#license" className = { resolveClass } >
199+ License
200+ </ Menu . Item >
201+ </ div >
214202
215- < div className = "py-1" >
216- < Menu . Item
217- as = "a"
218- href = "#sign-out"
219- className = { resolveClass }
220- >
221- Sign out
222- </ Menu . Item >
223- </ div >
224- </ Menu . Items >
225- </ Portal >
226- </ Transition >
227- </ >
228- ) }
203+ < div className = "py-1" >
204+ < Menu . Item as = "a" href = "#sign-out" className = { resolveClass } >
205+ Sign out
206+ </ Menu . Item >
207+ </ div >
208+ </ Menu . Items >
209+ </ Portal >
210+ </ Transition >
229211 </ Menu >
230212 </ div >
231213 </ div >
0 commit comments