Skip to content

Commit

Permalink
Added unpublished banner
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Nov 14, 2023
1 parent f5cf315 commit df93d23
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 2 additions & 3 deletions app/(public)/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {getMenu} from "@/lib/drupal/get-menu";
import {DrupalJsonApiParams} from "drupal-jsonapi-params";
import {isDraftMode} from "@/lib/drupal/is-draft-mode";
import {ExclamationCircleIcon} from "@heroicons/react/20/solid";
import UnpublishedBanner from "@/components/patterns/unpublished-banner";

export const revalidate = 1800;

Expand Down Expand Up @@ -85,9 +86,7 @@ const NodePage = async (context) => {
return (
<main id="main-content" className="su-mb-50">
{!node.status &&
<div className="su-bg-illuminating su-py-10 su-text-3xl su-font-bold">
<div className="su-centered-container su-flex su-gap-10"><ExclamationCircleIcon width={20}/>Unpublished</div>
</div>
<UnpublishedBanner/>
}
<Conditional showWhen={node.type === 'node--sul_library'}>
<LibraryHeader node={node as Library}/>
Expand Down
9 changes: 2 additions & 7 deletions components/paragraph/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Conditional from "@/components/utils/conditional";
import {ExclamationCircleIcon} from "@heroicons/react/20/solid";
import StanfordCard from "@/components/paragraph/stanford-card";
import StanfordBanner from "@/components/paragraph/stanford-banner";
import StanfordImageGallery from "@/components/paragraph/stanford-image-gallery";
Expand All @@ -14,6 +13,7 @@ import SulContactCard from "@/components/paragraph/sul-contact-card";
import SulButton from "@/components/paragraph/sul-button";
import {PropsWithoutRef, useId} from "react";
import SulLibguides from "@/components/paragraph/sul-libguides";
import UnpublishedBanner from "@/components/patterns/unpublished-banner";

interface ParagraphProps extends PropsWithoutRef<any> {
paragraph: any;
Expand All @@ -29,12 +29,7 @@ const Paragraph = ({paragraph, singleRow = false, ...props}: ParagraphProps) =>
return (
<>
<Conditional showWhen={paragraph.status != undefined && !paragraph.status}>
<div className="su-bg-illuminating-light su-py-30 su-mb-20">
<div className="su-centered su-text-m2 su-flex su-gap-lg">
<ExclamationCircleIcon width={40}/>
Unpublished Content
</div>
</div>
<UnpublishedBanner/>
</Conditional>

{paragraph.type === 'paragraph--stanford_card' &&
Expand Down
10 changes: 10 additions & 0 deletions components/patterns/unpublished-banner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {ExclamationCircleIcon} from "@heroicons/react/20/solid";

const UnpublishedBanner = () => {
return (
<div className="su-bg-illuminating su-py-10 su-text-3xl su-font-bold">
<div className="su-centered-container su-flex su-gap-10"><ExclamationCircleIcon width={20}/>Unpublished</div>
</div>
)
}
export default UnpublishedBanner
1 change: 1 addition & 0 deletions lib/drupal/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export async function buildHeaders({accessToken, headers = {"Content-Type": "app
headers?: HeadersInit
draftMode?: boolean
} = {}): Promise<Headers> {

if (process.env.REQUEST_HEADERS) {
headers = {...headers, ...JSON.parse(process.env.REQUEST_HEADERS)};
}
Expand Down

0 comments on commit df93d23

Please sign in to comment.