import { useRef, useState } from 'react'; import { FormattedMessage } from 'react-intl'; import TimezoneSetting from '../pages/settings/profile/TimezoneSetting'; import DateRangeSetting from '../pages/settings/profile/DateRangeSetting'; import { Button, Icon } from 'react-basics'; import styles from './SettingsButton.module.css'; import Gear from 'assets/gear.svg'; import useDocumentClick from '../../hooks/useDocumentClick'; export default function SettingsButton() { const [show, setShow] = useState(false); const ref = useRef(); function handleClick() { setShow(state => !state); } useDocumentClick(e => { if (!ref.current?.contains(e.target)) { setShow(false); } }); return (
{show && (
)}
); }