PluginProbe
Extendify / 0.2.0
Extendify v0.2.0
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / pages / layout / Layout.js

Layout.js in Extendify 0.2.0, at src/pages/layout/Layout.js

56 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4 import { __ } from '@wordpress/i18n'
5
6 /**
7 * Internal dependencies
8 */
9 import Sidebar from '../Sidebar'
10 import HasSidebar from './HasSidebar'
11 import { Toolbar } from './Toolbar'
12 import GridView from '../GridView'
13 import { useRef, useEffect } from '@wordpress/element'
14 import { useTemplatesStore } from '../../state/Templates'
15
16 export default function Layout({ setOpen }) {
17 const gridContainer = useRef()
18 const searchParams = useTemplatesStore((state) => state.searchParams)
19 useEffect(() => {
20 gridContainer.current.scrollTop = 0
21 }, [searchParams])
22
23 return (
24 <div className="h-full flex flex-col items-center relative max-w-screen-4xl mx-auto">
25 <div className="w-full flex-grow overflow-hidden">
26 <button
27 onClick={() =>
28 document
29 .getElementById('extendify-templates')
30 .querySelector('button')
31 .focus()
32 }
33 className="sr-only focus:not-sr-only focus:text-blue-500">
34 {__('Skip to content', 'extendify')}
35 </button>
36 <div className="sm:flex relative mx-auto h-full">
37 <HasSidebar>
38 <Sidebar />
39 <div className="relative h-full z-30 flex flex-col">
40 <Toolbar
41 className="hidden sm:block w-full h-20 flex-shrink-0 px-6 md:px-8"
42 hideLibrary={() => setOpen(false)}
43 />
44 <div
45 ref={gridContainer}
46 className="flex-grow z-20 overflow-y-auto px-6 md:px-8">
47 <GridView />
48 </div>
49 </div>
50 </HasSidebar>
51 </div>
52 </div>
53 </div>
54 )
55 }
56