@@ -14,6 +14,7 @@ import IconButton from './IconButton';
14
14
import CopyButton from './CopyButton' ;
15
15
import EmptyStreetImg from '../images/EmptyStreetImg' ;
16
16
import StickyList from './StickyList' ;
17
+ import Layout from './Layout' ;
17
18
18
19
function onStateChange ( { markup, query, result } ) {
19
20
state . save ( { markup, query } ) ;
@@ -114,7 +115,7 @@ function DomEvents() {
114
115
115
116
const sortDirection = useRef ( 'asc' ) ;
116
117
const [ appendMode , setAppendMode ] = useState ( 'bottom' ) ;
117
- const [ { markup, result } , dispatch ] = usePlayground ( {
118
+ const [ { markup, result, settings } , dispatch ] = usePlayground ( {
118
119
onChange : onStateChange ,
119
120
...initialValues ,
120
121
} ) ;
@@ -185,82 +186,84 @@ function DomEvents() {
185
186
} , [ ] ) ;
186
187
187
188
return (
188
- < div className = "flex flex-col h-auto md:h-full w-full" >
189
- < div className = "editor p-4 markup-editor gap-4 md:gap-8 md:h-56 flex-auto grid-cols-1 md:grid-cols-2" >
190
- < div className = "flex-auto relative h-56 md:h-full" >
191
- < MarkupEditor markup = { markup } dispatch = { dispatch } />
192
- </ div >
189
+ < Layout dispatch = { dispatch } status = { status } settings = { settings } >
190
+ < div className = "flex flex-col h-auto md:h-full w-full" >
191
+ < div className = "editor p-4 markup-editor gap-4 md:gap-8 md:h-56 flex-auto grid-cols-1 md:grid-cols-2" >
192
+ < div className = "flex-auto relative h-56 md:h-full" >
193
+ < MarkupEditor markup = { markup } dispatch = { dispatch } />
194
+ </ div >
193
195
194
- < div className = "flex-auto h-56 md:h-full" >
195
- < Preview
196
- forwardedRef = { setPreviewRef }
197
- markup = { markup }
198
- elements = { result . elements }
199
- accessibleRoles = { result . accessibleRoles }
200
- dispatch = { dispatch }
201
- variant = "minimal"
202
- />
196
+ < div className = "flex-auto h-56 md:h-full" >
197
+ < Preview
198
+ forwardedRef = { setPreviewRef }
199
+ markup = { markup }
200
+ elements = { result . elements }
201
+ accessibleRoles = { result . accessibleRoles }
202
+ dispatch = { dispatch }
203
+ variant = "minimal"
204
+ />
205
+ </ div >
203
206
</ div >
204
- </ div >
205
207
206
- < div className = "flex-none h-8" />
208
+ < div className = "flex-none h-8" />
207
209
208
- < div className = "editor p-4 md:h-56 flex-auto overflow-hidden" >
209
- < div className = "h-56 md:h-full w-full flex flex-col" >
210
- < div className = "h-8 flex items-center w-full text-sm font-bold" >
211
- < div
212
- className = "p-2 w-16 cursor-pointer flex justify-between items-center"
213
- onClick = { changeSortDirection }
214
- >
215
- # { getSortIcon ( ) }
216
- </ div >
210
+ < div className = "editor p-4 md:h-56 flex-auto overflow-hidden" >
211
+ < div className = "h-56 md:h-full w-full flex flex-col" >
212
+ < div className = "h-8 flex items-center w-full text-sm font-bold" >
213
+ < div
214
+ className = "p-2 w-16 cursor-pointer flex justify-between items-center"
215
+ onClick = { changeSortDirection }
216
+ >
217
+ # { getSortIcon ( ) }
218
+ </ div >
217
219
218
- < div className = "p-2 w-32 " > type</ div >
219
- < div className = "p-2 w-32 " > name</ div >
220
-
221
- < div className = "p-2 w-40 " > element</ div >
222
- < div className = "flex-auto p-2 flex justify-between" >
223
- < span > selector</ span >
224
- < div >
225
- < CopyButton
226
- text = { getTextToCopy }
227
- title = "copy log"
228
- className = "mr-5"
229
- />
230
- < IconButton title = "clear event log" onClick = { reset } >
231
- < TrashcanIcon />
232
- </ IconButton >
220
+ < div className = "p-2 w-32 " > type</ div >
221
+ < div className = "p-2 w-32 " > name</ div >
222
+
223
+ < div className = "p-2 w-40 " > element</ div >
224
+ < div className = "flex-auto p-2 flex justify-between" >
225
+ < span > selector</ span >
226
+ < div >
227
+ < CopyButton
228
+ text = { getTextToCopy }
229
+ title = "copy log"
230
+ className = "mr-5"
231
+ />
232
+ < IconButton title = "clear event log" onClick = { reset } >
233
+ < TrashcanIcon />
234
+ </ IconButton >
235
+ </ div >
233
236
</ div >
234
237
</ div >
235
- </ div >
236
238
237
- < div className = "flex-auto relative overflow-hidden" >
238
- { buffer . current . length === 0 ? (
239
- < div className = "flex w-full h-full opacity-50 items-end justify-center" >
240
- < EmptyStreetImg height = "80%" />
241
- </ div >
242
- ) : (
243
- < AutoSizer >
244
- { ( { width, height } ) => (
245
- < StickyList
246
- mode = { appendMode }
247
- ref = { listRef }
248
- height = { height }
249
- itemCount = { eventCount }
250
- itemData = { buffer . current }
251
- itemSize = { 32 }
252
- width = { width }
253
- outerElementType = { VirtualScrollable }
254
- >
255
- { EventRecord }
256
- </ StickyList >
257
- ) }
258
- </ AutoSizer >
259
- ) }
239
+ < div className = "flex-auto relative overflow-hidden" >
240
+ { buffer . current . length === 0 ? (
241
+ < div className = "flex w-full h-full opacity-50 items-end justify-center" >
242
+ < EmptyStreetImg height = "80%" />
243
+ </ div >
244
+ ) : (
245
+ < AutoSizer >
246
+ { ( { width, height } ) => (
247
+ < StickyList
248
+ mode = { appendMode }
249
+ ref = { listRef }
250
+ height = { height }
251
+ itemCount = { eventCount }
252
+ itemData = { buffer . current }
253
+ itemSize = { 32 }
254
+ width = { width }
255
+ outerElementType = { VirtualScrollable }
256
+ >
257
+ { EventRecord }
258
+ </ StickyList >
259
+ ) }
260
+ </ AutoSizer >
261
+ ) }
262
+ </ div >
260
263
</ div >
261
264
</ div >
262
265
</ div >
263
- </ div >
266
+ </ Layout >
264
267
) ;
265
268
}
266
269
0 commit comments