-
Notifications
You must be signed in to change notification settings - Fork 169
Expand file tree
/
Copy pathHeader.js
More file actions
63 lines (56 loc) · 1.66 KB
/
Header.js
File metadata and controls
63 lines (56 loc) · 1.66 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import {
faCog,
faKeyboard,
faShare
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import style from '../index.module.css';
class Header extends React.Component {
// to avoid unnecessary re-renders
shouldComponentUpdate(nextProps) {
if (nextProps !== this.props) return true;
return false;
}
render() {
const props = this.props;
return (<>
<header className={ style.header }>
{props.showSettings ? props.settings : null}
{props.showShortcuts ? props.shortcuts : null}
{props.showExportOptions ? props.exportOptions : null}
{props.tooltip}
</header>
<nav className={ style.nav }>
{props.mediaUrl === null ? null : props.mediaControls}
</nav>
<div className={ style.settingsContainer }>
<button
type="button"
className={ style.settingsButton }
title="Settings"
onClick={ props.handleSettingsToggle }
>
<FontAwesomeIcon icon={ faCog } />
</button>
<button
type="button"
className={ `${ style.settingsButton } ${ style.keyboardShortcutsButon }` }
title="view shortcuts"
onClick={ props.handleShortcutsToggle }
>
<FontAwesomeIcon icon={ faKeyboard } />
</button>
<button
type="button"
className={ `${ style.settingsButton }` }
title="Export"
onClick={ props.handleExportToggle }
>
<FontAwesomeIcon icon={ faShare } />
</button>
</div>
</>);
};
}
export default Header;