diff --git a/components/layout/Header.js b/components/layout/Header.js index 2cad662c..13c3954e 100644 --- a/components/layout/Header.js +++ b/components/layout/Header.js @@ -13,6 +13,7 @@ import useConfig from 'hooks/useConfig'; import useUser from 'hooks/useUser'; import Logo from 'assets/logo.svg'; import styles from './Header.module.css'; +import SettingsButton from '../settings/SettingsButton'; export default function Header() { const { user } = useUser(); @@ -46,6 +47,7 @@ export default function Header() {
+ {user && !adminDisabled && }
diff --git a/components/settings/SettingsButton.js b/components/settings/SettingsButton.js new file mode 100644 index 00000000..3799a3de --- /dev/null +++ b/components/settings/SettingsButton.js @@ -0,0 +1,45 @@ +import React, { useRef, useState } from 'react'; +import { FormattedMessage } from 'react-intl'; +import TimezoneSetting from './TimezoneSetting'; +import DateRangeSetting from './DateRangeSetting'; +import Button from 'components/common/Button'; +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 ( +
+
+ ); +} diff --git a/components/settings/SettingsButton.module.css b/components/settings/SettingsButton.module.css new file mode 100644 index 00000000..9f1b8cdb --- /dev/null +++ b/components/settings/SettingsButton.module.css @@ -0,0 +1,20 @@ +.button { + position: relative; +} + +.panel { + background: var(--gray50); + border: 1px solid var(--gray500); + border-radius: 4px; + display: flex; + flex-direction: column; + position: absolute; + top: 100%; + right: 0; + padding: 20px; + z-index: 100; +} + +.panel dd { + display: flex; +}