ReturnButton are now displayed on mobile and desktop are different places
This commit is contained in:
parent
3ab84b35da
commit
20a9bf2ba6
@ -1,4 +1,5 @@
|
|||||||
import Button from "components/Button";
|
import Button from "components/Button";
|
||||||
|
import HorizontalLine from "components/HorizontalLine";
|
||||||
import { useAppLayout } from "contexts/AppLayoutContext";
|
import { useAppLayout } from "contexts/AppLayoutContext";
|
||||||
import { GetWebsiteInterfaceQuery } from "graphql/operations-types";
|
import { GetWebsiteInterfaceQuery } from "graphql/operations-types";
|
||||||
|
|
||||||
@ -6,14 +7,37 @@ type ReturnButtonProps = {
|
|||||||
href: string;
|
href: string;
|
||||||
title: string;
|
title: string;
|
||||||
langui: GetWebsiteInterfaceQuery["websiteInterfaces"]["data"][number]["attributes"];
|
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 {
|
export default function ReturnButton(props: ReturnButtonProps): JSX.Element {
|
||||||
const appLayout = useAppLayout();
|
const appLayout = useAppLayout();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button onClick={() => appLayout.setSubPanelOpen(false)} href={props.href}>
|
<div
|
||||||
❮ {props.langui.return_to} {props.title}
|
className={`${
|
||||||
</Button>
|
props.displayOn === ReturnButtonType.Mobile
|
||||||
|
? "desktop:hidden"
|
||||||
|
: props.displayOn === ReturnButtonType.Desktop
|
||||||
|
? "mobile:hidden"
|
||||||
|
: ""
|
||||||
|
} ${props.className}`}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
onClick={() => appLayout.setSubPanelOpen(false)}
|
||||||
|
href={props.href}
|
||||||
|
>
|
||||||
|
❮ {props.langui.return_to} {props.title}
|
||||||
|
</Button>
|
||||||
|
{props.horizontalLine && <HorizontalLine />}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,9 @@ import { getWebsiteInterface } from "graphql/operations";
|
|||||||
import { GetStaticProps } from "next";
|
import { GetStaticProps } from "next";
|
||||||
import { GetWebsiteInterfaceQuery } from "graphql/operations-types";
|
import { GetWebsiteInterfaceQuery } from "graphql/operations-types";
|
||||||
import AppLayout from "components/AppLayout";
|
import AppLayout from "components/AppLayout";
|
||||||
import ReturnButton from "components/PanelComponents/ReturnButton";
|
import ReturnButton, {
|
||||||
|
ReturnButtonType,
|
||||||
|
} from "components/PanelComponents/ReturnButton";
|
||||||
|
|
||||||
type FourOhFourProps = {
|
type FourOhFourProps = {
|
||||||
langui: GetWebsiteInterfaceQuery;
|
langui: GetWebsiteInterfaceQuery;
|
||||||
@ -15,7 +17,12 @@ export default function FourOhFour(props: FourOhFourProps): JSX.Element {
|
|||||||
const contentPanel = (
|
const contentPanel = (
|
||||||
<ContentPanel>
|
<ContentPanel>
|
||||||
<h1>404 - {langui.page_not_found}</h1>
|
<h1>404 - {langui.page_not_found}</h1>
|
||||||
<ReturnButton href="/" title="Home" langui={langui} />
|
<ReturnButton
|
||||||
|
href="/"
|
||||||
|
title="Home"
|
||||||
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.Both}
|
||||||
|
/>
|
||||||
</ContentPanel>
|
</ContentPanel>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
|
@ -14,7 +14,9 @@ import HorizontalLine from "components/HorizontalLine";
|
|||||||
import ThumbnailHeader from "components/Content/ThumbnailHeader";
|
import ThumbnailHeader from "components/Content/ThumbnailHeader";
|
||||||
import AppLayout from "components/AppLayout";
|
import AppLayout from "components/AppLayout";
|
||||||
import SubPanel from "components/Panels/SubPanel";
|
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";
|
import { prettyinlineTitle, prettySlug } from "queries/helpers";
|
||||||
|
|
||||||
type ContentIndexProps = {
|
type ContentIndexProps = {
|
||||||
@ -27,12 +29,25 @@ export default function ContentIndex(props: ContentIndexProps): JSX.Element {
|
|||||||
const langui = props.langui.websiteInterfaces.data[0].attributes;
|
const langui = props.langui.websiteInterfaces.data[0].attributes;
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
<ReturnButton href="/contents" title={"Contents"} langui={langui} />
|
<ReturnButton
|
||||||
<HorizontalLine />
|
href="/contents"
|
||||||
|
title={"Contents"}
|
||||||
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.Desktop}
|
||||||
|
horizontalLine
|
||||||
|
/>
|
||||||
|
|
||||||
</SubPanel>
|
</SubPanel>
|
||||||
);
|
);
|
||||||
const contentPanel = (
|
const contentPanel = (
|
||||||
<ContentPanel>
|
<ContentPanel>
|
||||||
|
<ReturnButton
|
||||||
|
href="/contents"
|
||||||
|
title={"Contents"}
|
||||||
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.Mobile}
|
||||||
|
className="mb-10"
|
||||||
|
/>
|
||||||
<div className="grid place-items-center">
|
<div className="grid place-items-center">
|
||||||
<ThumbnailHeader content={content} langui={langui} />
|
<ThumbnailHeader content={content} langui={langui} />
|
||||||
|
|
||||||
|
@ -12,7 +12,9 @@ import {
|
|||||||
import ContentPanel from "components/Panels/ContentPanel";
|
import ContentPanel from "components/Panels/ContentPanel";
|
||||||
import HorizontalLine from "components/HorizontalLine";
|
import HorizontalLine from "components/HorizontalLine";
|
||||||
import SubPanel from "components/Panels/SubPanel";
|
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 ThumbnailHeader from "components/Content/ThumbnailHeader";
|
||||||
import AppLayout from "components/AppLayout";
|
import AppLayout from "components/AppLayout";
|
||||||
import Markdawn from "components/Markdown/Markdawn";
|
import Markdawn from "components/Markdown/Markdawn";
|
||||||
@ -46,10 +48,10 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
|
|||||||
href={`/contents/${content.slug}`}
|
href={`/contents/${content.slug}`}
|
||||||
title={"Content"}
|
title={"Content"}
|
||||||
langui={langui}
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.Desktop}
|
||||||
|
horizontalLine
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<HorizontalLine />
|
|
||||||
|
|
||||||
{content.text_set.length > 0 ? (
|
{content.text_set.length > 0 ? (
|
||||||
<div className="grid gap-5">
|
<div className="grid gap-5">
|
||||||
<h2 className="text-xl">
|
<h2 className="text-xl">
|
||||||
@ -138,6 +140,13 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
|
|||||||
);
|
);
|
||||||
const contentPanel = (
|
const contentPanel = (
|
||||||
<ContentPanel>
|
<ContentPanel>
|
||||||
|
<ReturnButton
|
||||||
|
href={`/contents/${content.slug}`}
|
||||||
|
title={"Content"}
|
||||||
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.Mobile}
|
||||||
|
className="mb-10"
|
||||||
|
/>
|
||||||
<div className="grid place-items-center">
|
<div className="grid place-items-center">
|
||||||
<ThumbnailHeader content={content} langui={langui} />
|
<ThumbnailHeader content={content} langui={langui} />
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ import {
|
|||||||
sortContent,
|
sortContent,
|
||||||
} from "queries/helpers";
|
} from "queries/helpers";
|
||||||
import SubPanel from "components/Panels/SubPanel";
|
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 NavOption from "components/PanelComponents/NavOption";
|
||||||
import Chip from "components/Chip";
|
import Chip from "components/Chip";
|
||||||
import Button from "components/Button";
|
import Button from "components/Button";
|
||||||
@ -59,8 +61,13 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
|
|||||||
|
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
<ReturnButton href="/library/" title={langui.library} langui={langui} />
|
<ReturnButton
|
||||||
<HorizontalLine />
|
href="/library/"
|
||||||
|
title={langui.library}
|
||||||
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.Desktop}
|
||||||
|
horizontalLine
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="grid gap-4">
|
<div className="grid gap-4">
|
||||||
<NavOption
|
<NavOption
|
||||||
@ -110,8 +117,15 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
|
|||||||
|
|
||||||
const contentPanel = (
|
const contentPanel = (
|
||||||
<ContentPanel width={ContentPanelWidthSizes.large}>
|
<ContentPanel width={ContentPanelWidthSizes.large}>
|
||||||
|
<ReturnButton
|
||||||
|
href="/library/"
|
||||||
|
title={langui.library}
|
||||||
|
langui={langui}
|
||||||
|
displayOn={ReturnButtonType.Mobile}
|
||||||
|
className="mb-10"
|
||||||
|
/>
|
||||||
<div className="grid place-items-center gap-12">
|
<div className="grid place-items-center gap-12">
|
||||||
<div className="drop-shadow-shade-xl w-full h-[50vh] mobile:h-[60vh] mb-16 relative cursor-pointer">
|
<div className="drop-shadow-shade-xl w-full h-[50vh] mobile:h-[60vh] desktop:mb-16 relative cursor-pointer">
|
||||||
{item.thumbnail.data ? (
|
{item.thumbnail.data ? (
|
||||||
<Img
|
<Img
|
||||||
image={item.thumbnail.data.attributes}
|
image={item.thumbnail.data.attributes}
|
||||||
|
@ -13,7 +13,9 @@ import {
|
|||||||
getWebsiteInterface,
|
getWebsiteInterface,
|
||||||
} from "graphql/operations";
|
} from "graphql/operations";
|
||||||
import NavOption from "components/PanelComponents/NavOption";
|
import NavOption from "components/PanelComponents/NavOption";
|
||||||
import ReturnButton from "components/PanelComponents/ReturnButton";
|
import ReturnButton, {
|
||||||
|
ReturnButtonType,
|
||||||
|
} from "components/PanelComponents/ReturnButton";
|
||||||
import HorizontalLine from "components/HorizontalLine";
|
import HorizontalLine from "components/HorizontalLine";
|
||||||
import AppLayout from "components/AppLayout";
|
import AppLayout from "components/AppLayout";
|
||||||
import {
|
import {
|
||||||
@ -72,9 +74,6 @@ export default function DataChronology(
|
|||||||
|
|
||||||
const subPanel = (
|
const subPanel = (
|
||||||
<SubPanel>
|
<SubPanel>
|
||||||
<ReturnButton href="/data" title="Data" langui={langui} />
|
|
||||||
<HorizontalLine />
|
|
||||||
|
|
||||||
{props.chronologyEras.chronologyEras.data.map((era) => (
|
{props.chronologyEras.chronologyEras.data.map((era) => (
|
||||||
<NavOption
|
<NavOption
|
||||||
key={era.id}
|
key={era.id}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user