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 (
+
+ }
+ onClick={handleClick}
+ aria-label={t("Search")}
+ neutral
+ borderOnHover
+ />
+
+ );
+}
+
export function SubscribeAction({
shareId,
documentId,
diff --git a/app/components/Sidebar/Shared.tsx b/app/components/Sidebar/Shared.tsx
index c74ea9cca5..7ef672f68d 100644
--- a/app/components/Sidebar/Shared.tsx
+++ b/app/components/Sidebar/Shared.tsx
@@ -4,7 +4,9 @@ import { SearchIcon } from "outline-icons";
import { useCallback, useEffect, useMemo } from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
+import { HEADER_HEIGHT } from "@shared/constants";
import { s } from "@shared/styles";
+import { breakpoint } from "@shared/styles/breakpoint";
import { ProsemirrorDataHelper } from "@shared/utils/ProsemirrorDataHelper";
import { metaDisplay, shortcutSeparator } from "@shared/utils/keyboard";
import type Share from "~/models/Share";
@@ -87,7 +89,7 @@ function SharedSidebar({ share }: Props) {
/>
)}
-
+
{t("Search")}
@@ -128,9 +130,16 @@ const ScrollContainer = styled(Scrollable)`
padding-bottom: 16px;
`;
-const TopSection = styled(Flex)`
+const TopSection = styled(Flex)<{ $hasBranding: boolean }>`
padding: 8px;
flex-shrink: 0;
+
+ /* Search is in the header on mobile. Keep the items clear of the header. */
+ ${breakpoint("mobile", "tablet")`
+ padding: 0;
+ min-height: ${(props: { $hasBranding: boolean }) =>
+ props.$hasBranding ? 0 : HEADER_HEIGHT}px;
+ `}
`;
const SearchButton = styled.button`
@@ -151,6 +160,10 @@ const SearchButton = styled.button`
border-color: ${s("inputBorderFocused")};
color: ${s("textSecondary")};
}
+
+ ${breakpoint("mobile", "tablet")`
+ display: none;
+ `}
`;
const SearchLabel = styled.span`
diff --git a/app/scenes/Document/components/SharedHeader.tsx b/app/scenes/Document/components/SharedHeader.tsx
index 4a0047d437..1443b9b019 100644
--- a/app/scenes/Document/components/SharedHeader.tsx
+++ b/app/scenes/Document/components/SharedHeader.tsx
@@ -17,6 +17,7 @@ import Flex from "~/components/Flex";
import Header from "~/components/Header";
import {
AppearanceAction,
+ SearchAction,
SubscribeAction,
} from "~/components/Sharing/components/Actions";
import AuthenticatedIsland from "~/components/Sharing/components/AuthenticatedIsland";
@@ -151,6 +152,7 @@ function SharedDocumentHeader({ document }: Props) {
)}
+ {hasSidebar && }
@@ -66,6 +70,7 @@ function SharedCollection({ collection }: Props) {
actions={
<>
+ {hasSidebar && }
{can.update ? editAction : null}
>
}