fix: add toc to mobile views and account for branding on shared view layouts (#2997)
* fix: add toc to mobile views and center the branding * add padding to bottom of sidebar * put the mobile branding inline * finesse the padding * make spelling of sign-in email less crazy looking * move mobile sidebar button into header * adds scene to search and 404 pages * fix title alignment * make filter buttons tight * clean up unused imports * lint Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -394,10 +394,12 @@ class DocumentScene extends React.Component<Props> {
|
||||
const value = revision ? revision.text : document.text;
|
||||
const embedsDisabled =
|
||||
(team && team.documentEmbeds === false) || document.embedsDisabled;
|
||||
|
||||
const headings = this.editor.current
|
||||
? // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
|
||||
this.editor.current.getHeadings()
|
||||
: [];
|
||||
|
||||
const showContents =
|
||||
ui.tocVisible && (readOnly || team?.collaborativeEditing);
|
||||
const collaborativeEditing =
|
||||
@@ -615,11 +617,11 @@ class DocumentScene extends React.Component<Props> {
|
||||
</Flex>
|
||||
</React.Suspense>
|
||||
</MaxWidth>
|
||||
{isShare && !isCustomDomain() && (
|
||||
<Branding href="//www.getoutline.com?ref=sharelink" />
|
||||
)}
|
||||
</Container>
|
||||
</Background>
|
||||
{isShare && !isCustomDomain() && (
|
||||
<Branding href="//www.getoutline.com?ref=sharelink" />
|
||||
)}
|
||||
{!isShare && (
|
||||
<>
|
||||
<KeyboardShortcutsButton />
|
||||
@@ -666,6 +668,8 @@ const MaxWidth = styled(Flex)<MaxWidthProps>`
|
||||
max-width: 100vw;
|
||||
width: 100%;
|
||||
|
||||
padding-bottom: 16px;
|
||||
|
||||
${breakpoint("tablet")`
|
||||
margin: 4px auto 12px;
|
||||
max-width: ${(props: MaxWidthProps) =>
|
||||
|
||||
@@ -164,14 +164,19 @@ function DocumentHeader({
|
||||
return (
|
||||
<Header
|
||||
title={document.title}
|
||||
hasSidebar={!!sharedTree}
|
||||
breadcrumb={
|
||||
<PublicBreadcrumb
|
||||
documentId={document.id}
|
||||
shareId={shareId}
|
||||
sharedTree={sharedTree}
|
||||
>
|
||||
{toc}
|
||||
</PublicBreadcrumb>
|
||||
isMobile ? (
|
||||
<TableOfContentsMenu headings={headings} />
|
||||
) : (
|
||||
<PublicBreadcrumb
|
||||
documentId={document.id}
|
||||
shareId={shareId}
|
||||
sharedTree={sharedTree}
|
||||
>
|
||||
{toc}
|
||||
</PublicBreadcrumb>
|
||||
)
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
@@ -186,10 +191,15 @@ function DocumentHeader({
|
||||
return (
|
||||
<>
|
||||
<Header
|
||||
hasSidebar
|
||||
breadcrumb={
|
||||
<DocumentBreadcrumb document={document}>
|
||||
{!isEditing && toc}
|
||||
</DocumentBreadcrumb>
|
||||
isMobile ? (
|
||||
<TableOfContentsMenu headings={headings} />
|
||||
) : (
|
||||
<DocumentBreadcrumb document={document}>
|
||||
{!isEditing && toc}
|
||||
</DocumentBreadcrumb>
|
||||
)
|
||||
}
|
||||
title={
|
||||
<>
|
||||
@@ -200,11 +210,7 @@ function DocumentHeader({
|
||||
actions={
|
||||
<>
|
||||
<ObservingBanner />
|
||||
{isMobile && (
|
||||
<TocWrapper>
|
||||
<TableOfContentsMenu headings={headings} />
|
||||
</TocWrapper>
|
||||
)}
|
||||
|
||||
{!isPublishing && isSaving && !team?.collaborativeEditing && (
|
||||
<Status>{t("Saving")}…</Status>
|
||||
)}
|
||||
@@ -328,9 +334,4 @@ const Status = styled(Action)`
|
||||
color: ${(props) => props.theme.slate};
|
||||
`;
|
||||
|
||||
const TocWrapper = styled(Action)`
|
||||
position: absolute;
|
||||
left: 42px;
|
||||
`;
|
||||
|
||||
export default observer(DocumentHeader);
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
import * as React from "react";
|
||||
import { useTranslation, Trans } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import CenteredContent from "~/components/CenteredContent";
|
||||
import Empty from "~/components/Empty";
|
||||
import PageTitle from "~/components/PageTitle";
|
||||
import Scene from "~/components/Scene";
|
||||
|
||||
const Error404 = () => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<CenteredContent>
|
||||
<PageTitle title={t("Not found")} />
|
||||
<h1>{t("Not found")}</h1>
|
||||
<Scene title={t("Not Found")}>
|
||||
<h1>{t("Not Found")}</h1>
|
||||
<Empty>
|
||||
<Trans>
|
||||
We were unable to find the page you’re looking for. Go to the{" "}
|
||||
<Link to="/home">homepage</Link>?
|
||||
</Trans>
|
||||
</Empty>
|
||||
</CenteredContent>
|
||||
</Scene>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -14,15 +14,14 @@ import { DateFilter as TDateFilter } from "@shared/types";
|
||||
import { DEFAULT_PAGINATION_LIMIT } from "~/stores/BaseStore";
|
||||
import { SearchParams } from "~/stores/DocumentsStore";
|
||||
import RootStore from "~/stores/RootStore";
|
||||
import CenteredContent from "~/components/CenteredContent";
|
||||
import DocumentListItem from "~/components/DocumentListItem";
|
||||
import Empty from "~/components/Empty";
|
||||
import Fade from "~/components/Fade";
|
||||
import Flex from "~/components/Flex";
|
||||
import HelpText from "~/components/HelpText";
|
||||
import LoadingIndicator from "~/components/LoadingIndicator";
|
||||
import PageTitle from "~/components/PageTitle";
|
||||
import RegisterKeyDown from "~/components/RegisterKeyDown";
|
||||
import Scene from "~/components/Scene";
|
||||
import withStores from "~/components/withStores";
|
||||
import { searchUrl } from "~/utils/routeHelpers";
|
||||
import { decodeURIComponentSafe } from "~/utils/urls";
|
||||
@@ -259,8 +258,7 @@ class Search extends React.Component<Props> {
|
||||
const showEmpty = !this.isLoading && this.query && results.length === 0;
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<PageTitle title={this.title} />
|
||||
<Scene textTitle={this.title}>
|
||||
<RegisterKeyDown trigger="Escape" handler={this.goBack} />
|
||||
{this.isLoading && <LoadingIndicator />}
|
||||
{notFound && (
|
||||
@@ -351,7 +349,7 @@ class Search extends React.Component<Props> {
|
||||
)}
|
||||
</ResultList>
|
||||
</ResultsWrapper>
|
||||
</Container>
|
||||
</Scene>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -363,15 +361,8 @@ const Centered = styled(Flex)`
|
||||
transform: translateY(-50%);
|
||||
`;
|
||||
|
||||
const Container = styled(CenteredContent)`
|
||||
> div {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
}
|
||||
`;
|
||||
|
||||
const ResultsWrapper = styled(Flex)`
|
||||
${breakpoint("tablet")`
|
||||
${breakpoint("tablet")`
|
||||
margin-top: 40px;
|
||||
`};
|
||||
`;
|
||||
@@ -394,7 +385,7 @@ const Filters = styled(Flex)`
|
||||
overflow-x: auto;
|
||||
padding: 8px 0;
|
||||
|
||||
${breakpoint("tablet")`
|
||||
${breakpoint("tablet")`
|
||||
padding: 0;
|
||||
`};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user