diff --git a/components/helpers/StickyHeader.js b/components/helpers/StickyHeader.js index 29daeb51..62dcb74a 100644 --- a/components/helpers/StickyHeader.js +++ b/components/helpers/StickyHeader.js @@ -1,17 +1,16 @@ -import { useEffect, useRef } from 'react'; -import { useMeasure, useCombinedRefs } from 'react-basics'; +import { useMeasure } from 'react-basics'; import classNames from 'classnames'; import useSticky from 'hooks/useSticky'; -import { UI_LAYOUT_BODY } from 'lib/constants'; export default function StickyHeader({ className, stickyClassName, stickyStyle, enabled = true, + scrollElement, children, }) { - const { ref: scrollRef, isSticky } = useSticky({ scrollElementId: UI_LAYOUT_BODY }); + const { ref: scrollRef, isSticky } = useSticky({ scrollElement }); const { ref: measureRef, dimensions } = useMeasure(); return ( diff --git a/components/input/LanguageButton.js b/components/input/LanguageButton.js index f01b4716..afd447ac 100644 --- a/components/input/LanguageButton.js +++ b/components/input/LanguageButton.js @@ -7,7 +7,7 @@ import Icons from 'components/icons'; import { labels } from 'components/messages'; import styles from './LanguageButton.module.css'; -export default function LanguageButton({ tooltipPosition = 'top' }) { +export default function LanguageButton({ tooltipPosition = 'top', menuPosition = 'right' }) { const { formatMessage } = useIntl(); const { locale, saveLocale } = useLocale(); const items = Object.keys(languages).map(key => ({ ...languages[key], value: key })); @@ -25,7 +25,7 @@ export default function LanguageButton({ tooltipPosition = 'top' }) { - +
{items.map(({ value, label }) => { return ( diff --git a/components/input/SettingsButton.js b/components/input/SettingsButton.js index 7c2a2ae2..46a01e13 100644 --- a/components/input/SettingsButton.js +++ b/components/input/SettingsButton.js @@ -1,49 +1,33 @@ -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 { useIntl } from 'react-intl'; +import { Button, Icon, Tooltip, PopupTrigger, Popup, Form, FormRow } from 'react-basics'; +import TimezoneSetting from 'components/pages/settings/profile/TimezoneSetting'; +import DateRangeSetting from 'components/pages/settings/profile/DateRangeSetting'; +import Icons from 'components/icons'; +import { labels } from 'components/messages'; 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); - } - }); + const { formatMessage } = useIntl(); return ( -
- - {show && ( -
-
- -
-
+ + + + + +
+ -
-
- -
-
+ + -
-
- )} -
+ + + + ); } diff --git a/components/input/SettingsButton.module.css b/components/input/SettingsButton.module.css index 57084735..0f6f90ea 100644 --- a/components/input/SettingsButton.module.css +++ b/components/input/SettingsButton.module.css @@ -1,8 +1,4 @@ -.button { - position: relative; -} - -.panel { +.popup { background: var(--base50); border: 1px solid var(--base500); border-radius: 4px; @@ -14,7 +10,3 @@ padding: 20px; z-index: 100; } - -.panel dd { - display: flex; -} diff --git a/components/input/ThemeButton.js b/components/input/ThemeButton.js index 656a7dad..cca3560a 100644 --- a/components/input/ThemeButton.js +++ b/components/input/ThemeButton.js @@ -1,5 +1,5 @@ import { useTransition, animated } from 'react-spring'; -import { Button, Icon, PopupTrigger, Tooltip } from 'react-basics'; +import { Button, Icon, Tooltip } from 'react-basics'; import { useIntl } from 'react-intl'; import useTheme from 'hooks/useTheme'; import Icons from 'components/icons'; diff --git a/components/input/ThemeButton.module.css b/components/input/ThemeButton.module.css index 3f7c705a..c64647eb 100644 --- a/components/input/ThemeButton.module.css +++ b/components/input/ThemeButton.module.css @@ -1,6 +1,5 @@ .button { width: 50px; - height: 50px; display: flex; justify-content: center; align-items: center; diff --git a/components/layout/Header.js b/components/layout/Header.js index 88499768..9b5f0a2f 100644 --- a/components/layout/Header.js +++ b/components/layout/Header.js @@ -1,38 +1,31 @@ -import { useRouter } from 'next/router'; -import { Column, Row } from 'react-basics'; -import classNames from 'classnames'; -import HamburgerButton from 'components/common/HamburgerButton'; -import UpdateNotice from 'components/common/UpdateNotice'; +import { Column, Icon, Row, Text } from 'react-basics'; +import Link from 'next/link'; import LanguageButton from 'components/input/LanguageButton'; import ThemeButton from 'components/input/ThemeButton'; -import UserButton from 'components/input/UserButton'; import SettingsButton from 'components/input/SettingsButton'; -import useConfig from 'hooks/useConfig'; -import useUser from 'hooks/useUser'; +import Icons from 'components/icons'; import styles from './Header.module.css'; -export default function Header({ className }) { - const { user } = useUser(); - const { pathname } = useRouter(); - const { updatesDisabled, adminDisabled } = useConfig(); - const isSharePage = pathname.includes('/share/'); - const allowUpdate = user?.isAdmin && !updatesDisabled && !isSharePage; - +export default function Header() { return ( - <> - {allowUpdate && } -
- - - - - - - - {user && !adminDisabled && } - - -
- +
+ + + + + + + + umami + + + + + + + + + +
); } diff --git a/components/layout/Header.module.css b/components/layout/Header.module.css index f1dbfdfd..c896e967 100644 --- a/components/layout/Header.module.css +++ b/components/layout/Header.module.css @@ -2,42 +2,24 @@ display: flex; align-items: center; width: 100%; - height: 50px; - border-bottom: 1px solid var(--base300); + padding: 30px 30px 0 30px; } .title { - flex: 1; + display: flex; + flex-direction: row; + align-items: center; + gap: 10px; font-size: var(--font-size-lg); font-weight: 700; - display: flex; - align-items: center; - flex-direction: row; -} - -.logo { - margin-right: 12px; -} - -.links { - flex: 2; - display: flex; - justify-content: center; - align-items: center; - font-size: var(--font-size-md); - font-weight: 600; -} - -.links a + a { - margin-left: 40px; + color: var(--font-color100); } .buttons { - flex: 1; display: flex; flex-direction: row; - justify-content: flex-end; align-items: center; + justify-content: flex-end; } @media only screen and (max-width: 992px) { diff --git a/components/layout/ShareLayout.js b/components/layout/ShareLayout.js new file mode 100644 index 00000000..2e3fe3a4 --- /dev/null +++ b/components/layout/ShareLayout.js @@ -0,0 +1,13 @@ +import { Container } from 'react-basics'; +import Header from './Header'; +import Footer from './Footer'; + +export default function ShareLayout({ children }) { + return ( + +
+ {children} +