blob: 0fa4a0fca0569ef27b9cd5b985ba5d2d3f19e375 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import * as React from 'react';
import { observer } from 'mobx-react';
import "./NaviconButton.scss";
import * as $ from 'jquery';
import { observable } from 'mobx';
export interface NaviconProps {
onClick(): void;
}
export class NaviconButton extends React.Component<NaviconProps> {
@observable private _ref: React.RefObject<HTMLAnchorElement> = React.createRef();
componentDidMount = () => {
const that = this;
if (this._ref.current) {
this._ref.current.addEventListener("click", function (e) {
e.preventDefault();
if (that._ref.current) {
that._ref.current.classList.toggle('active');
return false;
}
});
}
}
render() {
return (
<a id="hamburger-icon" href="#" ref={this._ref} title="Menu">
<span className="line line-1"></span>
<span className="line line-2"></span>
<span className="line line-3"></span>
</a>
);
}
}
|