src/layouts/index.tsx   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 0

Size

Lines of Code 63
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 50
mnd 4
bc 4
fnc 0
dl 0
loc 63
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import $ from "jquery"
2
import React, { Fragment, useEffect, PropsWithChildren } from "react"
3
4
import { PageFooter } from "../components/PageFooter"
5
import { PageHeader, PageHeaderMobile } from "../components/PageHeader"
6
7
declare global {
8
  interface JQuery {
9
    foundation(): void
10
  }
11
}
12
13
const Layout = ({ children }: PropsWithChildren) => {
14
  useEffect(() => {
15
    // eslint-disable-next-line
16
    const foundation = require(`foundation-sites`)
17
    $(document).foundation()
18
19
    $(`.main-nav a`).on(`click`, function () {
20
      if ($(this)?.attr(`href`)?.indexOf(window.location.pathname) === 0 && window.location.hash) {
21
        const url = $(this).attr(`href`) || ``
22
        const hash = url.substring(url.indexOf(`#`))
23
24
        $(`.team__sub_navigation a[href="${hash}"]`).trigger(`click`, [true])
25
      }
26
    })
27
28
    if (window.location.hash) {
29
      $(`.team__sub_navigation a[href="${window.location.hash}"]`).trigger(`click`, [true])
30
    }
31
    // $(`.widget__filter, .team__sub_navigation__tabs`).on(`change.zf.tabs`, function () {
32
    //   // LazyLoad.shouldComponentUpdate()
33
    // })
34
  }, [])
35
36
  return (
37
    <Fragment>
38
      <div className={`off-canvas-wrapper`}>
39
        <PageHeaderMobile />
40
        <PageHeader />
41
42
        <main className={`off-canvas-content`} data-off-canvas-content>
43
          {children}
44
        </main>
45
46
        <PageFooter />
47
      </div>
48
    </Fragment>
49
  )
50
}
51
52
export const FullScreenLayout = ({ children }: PropsWithChildren) => {
53
  return (
54
    <Fragment>
55
      <div style={{ padding: `2em`, textTransform: `uppercase`, fontWeight: `bold`, fontSize: `80%` }}>
56
        <main>{children}</main>
57
      </div>
58
    </Fragment>
59
  )
60
}
61
62
export default Layout
63