2018-07-05 16:49:34 +02:00
|
|
|
import React, { Component } from 'react'
|
2018-07-05 17:28:49 +02:00
|
|
|
import Link from 'gatsby-link'
|
2018-07-05 16:49:34 +02:00
|
|
|
|
2018-07-05 16:53:33 +02:00
|
|
|
import './SideMenu.css'
|
2018-07-05 16:49:34 +02:00
|
|
|
class SideMenu extends Component {
|
2018-07-05 16:53:33 +02:00
|
|
|
componentDidMount() {
|
|
|
|
|
var Slideout = require('slideout')
|
|
|
|
|
|
|
|
|
|
const slideout = new Slideout({
|
|
|
|
|
panel: document.querySelector('.side-panel'),
|
|
|
|
|
menu: document.querySelector('.side-menu'),
|
|
|
|
|
toggle: document.querySelector('.side-toggle'),
|
|
|
|
|
padding: 0,
|
|
|
|
|
tolerance: 70,
|
|
|
|
|
side: 'right',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
document
|
|
|
|
|
.querySelector('.side-toggle')
|
|
|
|
|
.addEventListener('click', function() {
|
|
|
|
|
slideout.toggle()
|
|
|
|
|
})
|
2018-07-05 17:52:02 +02:00
|
|
|
|
|
|
|
|
function close(e) {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
slideout.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
slideout
|
|
|
|
|
.on('beforeopen', function() {
|
|
|
|
|
this.panel.classList.add('panel-open')
|
|
|
|
|
})
|
|
|
|
|
.on('open', function() {
|
|
|
|
|
this.panel.addEventListener('click', close)
|
2018-07-05 18:14:05 +02:00
|
|
|
document.querySelector('.side-close').addEventListener('click', close)
|
2018-07-05 17:52:02 +02:00
|
|
|
})
|
|
|
|
|
.on('beforeclose', function() {
|
|
|
|
|
this.panel.classList.remove('panel-open')
|
|
|
|
|
this.panel.removeEventListener('click', close)
|
|
|
|
|
})
|
2018-07-05 16:53:33 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-05 16:49:34 +02:00
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div className="side-menu">
|
2018-07-05 17:28:49 +02:00
|
|
|
<ul className="m-0 p-0 mt-4 side-navigation">
|
2018-07-05 17:52:02 +02:00
|
|
|
<button
|
2018-07-05 18:14:05 +02:00
|
|
|
className="text-white text-3xl mb-4 opacity-50 hover:opacity-100 px-2 side-close"
|
2018-07-05 17:52:02 +02:00
|
|
|
onClick={this.close}
|
|
|
|
|
>
|
|
|
|
|
X
|
|
|
|
|
</button>
|
2018-07-05 18:14:05 +02:00
|
|
|
<Link to="/">
|
|
|
|
|
<li className="text-right no-underline text-2xl uppercase p-2 text-white">
|
|
|
|
|
Home
|
|
|
|
|
</li>
|
|
|
|
|
</Link>
|
2018-07-05 17:28:49 +02:00
|
|
|
<Link to="/services">
|
2018-07-05 17:52:02 +02:00
|
|
|
<li className="text-right no-underline text-2xl uppercase p-2 text-white">
|
2018-07-05 17:28:49 +02:00
|
|
|
What We Do
|
|
|
|
|
</li>
|
|
|
|
|
</Link>
|
|
|
|
|
<Link to="/about">
|
2018-07-05 17:52:02 +02:00
|
|
|
<li className="text-right no-underline text-2xl uppercase p-2 text-white">
|
2018-07-05 17:28:49 +02:00
|
|
|
Team
|
|
|
|
|
</li>
|
|
|
|
|
</Link>
|
|
|
|
|
<Link to="/blog">
|
2018-07-05 17:52:02 +02:00
|
|
|
<li className="text-right no-underline text-2xl uppercase p-2 text-white">
|
2018-07-05 17:28:49 +02:00
|
|
|
Blog
|
|
|
|
|
</li>
|
|
|
|
|
</Link>
|
|
|
|
|
</ul>
|
2018-07-05 16:49:34 +02:00
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default SideMenu
|