PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 3.3.3
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v3.3.3
4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 2.6.1 All 38 releases
blockspare / admin / layout / Layout.js

Layout.js in BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites 3.3.3, at admin/layout/Layout.js

40 lines 989 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React, { useState, useEffect } from 'react'
2 import Home from '../pages/Home'
3 import Designs from '../pages/demo/Designs'
4 import Header from '../components/Header'
5 import Container from '../components/Container'
6
7 const Layout = () => {
8 const [current, setCurrent] = useState(0)
9 const activeNavHandler = (activeNavItem) => {
10 sessionStorage.setItem('main-nav', activeNavItem);
11 setCurrent(activeNavItem);
12 };
13 useEffect(() => {
14 sessionStorage.removeItem('main-nav')
15 const active = sessionStorage.getItem('main-nav');
16 if (active) {
17 setCurrent(+active)
18 }
19 }, [])
20 const content = [
21
22 <Designs />,
23 <Home />
24
25
26 ]
27 return (
28 <>
29 <Header current={current} activeNavHandler={activeNavHandler} />
30 <main>
31 <Container>
32 {content[current]}
33 </Container>
34 </main>
35 </>
36 )
37 }
38
39 export default Layout
40