Allow esc to close Account sheet

This commit is contained in:
Lim Chee Aun 2023-02-22 13:28:01 +08:00
parent 2120a1e28e
commit 8a41599466

View file

@ -1,6 +1,7 @@
import './account.css';
import { useEffect, useRef, useState } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { api } from '../utils/api';
import emojifyText from '../utils/emojify-text';
@ -82,8 +83,11 @@ function Account({ account, instance: propInstance, onClose }) {
username,
} = info || {};
const escRef = useHotkeys('esc', onClose, [onClose]);
return (
<div
ref={escRef}
id="account-container"
class={`sheet ${uiState === 'loading' ? 'skeleton' : ''}`}
>