diff --git a/app/components/Header.tsx b/app/components/Header.tsx index 4b0d2fa73a..d336b1c7b5 100644 --- a/app/components/Header.tsx +++ b/app/components/Header.tsx @@ -238,6 +238,15 @@ const Actions = styled(Flex)` margin-inline: -4px; } + /* A single action shows as a circle, like the menu button. */ + &:has(> :only-child) { + padding-inline: 0; + } + + & > :only-child { + margin-inline: 0; + } + && [data-variant] { background: transparent; box-shadow: none; diff --git a/app/components/Sharing/components/Actions.tsx b/app/components/Sharing/components/Actions.tsx index 5a6802de21..64593114ea 100644 --- a/app/components/Sharing/components/Actions.tsx +++ b/app/components/Sharing/components/Actions.tsx @@ -1,6 +1,7 @@ +import { useKBar } from "kbar"; import { observer } from "mobx-react"; -import { MoonIcon, SunIcon, SubscribeIcon } from "outline-icons"; -import { useState } from "react"; +import { MoonIcon, SearchIcon, SunIcon, SubscribeIcon } from "outline-icons"; +import { useCallback, useState } from "react"; import { useTranslation } from "react-i18next"; import { Action } from "~/components/Actions"; import Button from "~/components/Button"; @@ -11,6 +12,7 @@ import { } from "~/components/primitives/Popover"; import Tooltip from "~/components/Tooltip"; import { ShareSubscribeForm } from "./ShareSubscribeForm"; +import useMobile from "~/hooks/useMobile"; import useStores from "~/hooks/useStores"; import { Theme } from "~/stores/UiStore"; @@ -18,9 +20,10 @@ export const AppearanceAction = observer(() => { const { t } = useTranslation(); const { ui } = useStores(); const { resolvedTheme, themeOverride } = ui; + const isMobile = useMobile(); // Hide when theme is locked via query parameter - if (themeOverride) { + if (themeOverride || isMobile) { return null; } @@ -50,6 +53,36 @@ export const AppearanceAction = observer(() => { ); }); +/** + * A header button that opens search on public shares, shown only on mobile + * where the sidebar search button is hidden. + */ +export function SearchAction() { + const { t } = useTranslation(); + const { query } = useKBar(); + const isMobile = useMobile(); + + const handleClick = useCallback(() => { + query.toggle(); + }, [query]); + + if (!isMobile) { + return null; + } + + return ( + +