this repo has no description
1import { useHotkeys } from 'react-hotkeys-hook';
2
3import openCompose from '../utils/open-compose';
4import states from '../utils/states';
5
6import Icon from './icon';
7
8export default function ComposeButton() {
9 function handleButton(e) {
10 if (e.shiftKey) {
11 const newWin = openCompose();
12
13 if (!newWin) {
14 states.showCompose = true;
15 }
16 } else {
17 states.showCompose = true;
18 }
19 }
20
21 useHotkeys('c, shift+c', handleButton, {
22 ignoreEventWhen: (e) => {
23 const hasModal = !!document.querySelector('#modal-container > *');
24 return hasModal;
25 },
26 });
27
28 return (
29 <button type="button" id="compose-button" onClick={handleButton}>
30 <Icon icon="quill" size="xl" alt="Compose" />
31 </button>
32 );
33}