From 20a9bf2ba6cd1e1df47faa27b26b8ed43a79e957 Mon Sep 17 00:00:00 2001 From: DrMint Date: Sun, 6 Mar 2022 04:13:18 +0100 Subject: [PATCH] ReturnButton are now displayed on mobile and desktop are different places --- .../PanelComponents/ReturnButton.tsx | 30 +++++++++++++++++-- src/pages/404.tsx | 11 +++++-- src/pages/contents/[slug]/index.tsx | 21 +++++++++++-- src/pages/contents/[slug]/read.tsx | 15 ++++++++-- src/pages/library/[slug].tsx | 22 +++++++++++--- src/pages/wiki/chronology.tsx | 7 ++--- 6 files changed, 87 insertions(+), 19 deletions(-) diff --git a/src/components/PanelComponents/ReturnButton.tsx b/src/components/PanelComponents/ReturnButton.tsx index c208c2b..35cbc26 100644 --- a/src/components/PanelComponents/ReturnButton.tsx +++ b/src/components/PanelComponents/ReturnButton.tsx @@ -1,4 +1,5 @@ import Button from "components/Button"; +import HorizontalLine from "components/HorizontalLine"; import { useAppLayout } from "contexts/AppLayoutContext"; import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; @@ -6,14 +7,37 @@ type ReturnButtonProps = { href: string; title: string; langui: GetWebsiteInterfaceQuery["websiteInterfaces"]["data"][number]["attributes"]; + displayOn: ReturnButtonType; + horizontalLine?: boolean; + className?: string; }; +export enum ReturnButtonType { + Mobile, + Desktop, + Both, +} + export default function ReturnButton(props: ReturnButtonProps): JSX.Element { const appLayout = useAppLayout(); return ( - +
+ + {props.horizontalLine && } +
); } diff --git a/src/pages/404.tsx b/src/pages/404.tsx index c54d2b5..5e312fd 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -4,7 +4,9 @@ import { getWebsiteInterface } from "graphql/operations"; import { GetStaticProps } from "next"; import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; import AppLayout from "components/AppLayout"; -import ReturnButton from "components/PanelComponents/ReturnButton"; +import ReturnButton, { + ReturnButtonType, +} from "components/PanelComponents/ReturnButton"; type FourOhFourProps = { langui: GetWebsiteInterfaceQuery; @@ -15,7 +17,12 @@ export default function FourOhFour(props: FourOhFourProps): JSX.Element { const contentPanel = (

404 - {langui.page_not_found}

- +
); return ( diff --git a/src/pages/contents/[slug]/index.tsx b/src/pages/contents/[slug]/index.tsx index 144ecda..f8b78cd 100644 --- a/src/pages/contents/[slug]/index.tsx +++ b/src/pages/contents/[slug]/index.tsx @@ -14,7 +14,9 @@ import HorizontalLine from "components/HorizontalLine"; import ThumbnailHeader from "components/Content/ThumbnailHeader"; import AppLayout from "components/AppLayout"; import SubPanel from "components/Panels/SubPanel"; -import ReturnButton from "components/PanelComponents/ReturnButton"; +import ReturnButton, { + ReturnButtonType, +} from "components/PanelComponents/ReturnButton"; import { prettyinlineTitle, prettySlug } from "queries/helpers"; type ContentIndexProps = { @@ -27,12 +29,25 @@ export default function ContentIndex(props: ContentIndexProps): JSX.Element { const langui = props.langui.websiteInterfaces.data[0].attributes; const subPanel = ( - - + + ); const contentPanel = ( +
diff --git a/src/pages/contents/[slug]/read.tsx b/src/pages/contents/[slug]/read.tsx index f6dd015..7f27b8f 100644 --- a/src/pages/contents/[slug]/read.tsx +++ b/src/pages/contents/[slug]/read.tsx @@ -12,7 +12,9 @@ import { import ContentPanel from "components/Panels/ContentPanel"; import HorizontalLine from "components/HorizontalLine"; import SubPanel from "components/Panels/SubPanel"; -import ReturnButton from "components/PanelComponents/ReturnButton"; +import ReturnButton, { + ReturnButtonType, +} from "components/PanelComponents/ReturnButton"; import ThumbnailHeader from "components/Content/ThumbnailHeader"; import AppLayout from "components/AppLayout"; import Markdawn from "components/Markdown/Markdawn"; @@ -46,10 +48,10 @@ export default function ContentRead(props: ContentReadProps): JSX.Element { href={`/contents/${content.slug}`} title={"Content"} langui={langui} + displayOn={ReturnButtonType.Desktop} + horizontalLine /> - - {content.text_set.length > 0 ? (

@@ -138,6 +140,13 @@ export default function ContentRead(props: ContentReadProps): JSX.Element { ); const contentPanel = ( +
diff --git a/src/pages/library/[slug].tsx b/src/pages/library/[slug].tsx index 89ed785..6b7da04 100644 --- a/src/pages/library/[slug].tsx +++ b/src/pages/library/[slug].tsx @@ -26,7 +26,9 @@ import { sortContent, } from "queries/helpers"; import SubPanel from "components/Panels/SubPanel"; -import ReturnButton from "components/PanelComponents/ReturnButton"; +import ReturnButton, { + ReturnButtonType, +} from "components/PanelComponents/ReturnButton"; import NavOption from "components/PanelComponents/NavOption"; import Chip from "components/Chip"; import Button from "components/Button"; @@ -59,8 +61,13 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element { const subPanel = ( - - +
+
-
+
{item.thumbnail.data ? ( - - - {props.chronologyEras.chronologyEras.data.map((era) => (