Skip to content

Commit

Permalink
Add a notice bar to the preview page of a listing (#1532)
Browse files Browse the repository at this point in the history
* Add a notice bar to the preview page of a listing

* Move style to TW classes

* Update changelog with #1507

Co-authored-by: seanmalbert <smabert@gmail.com>
  • Loading branch information
jaredcwhite and seanmalbert authored Jul 27, 2021
1 parent 6f23e34 commit e5898d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ All notable changes to this project will be documented in this file. The format
- refactors listing form submit to fix double submit issue ([#1501](https://github.com/bloom-housing/bloom/pull/1501))

- Added:
- A notice bar to the preview page of a listing ([#1532](https://github.com/bloom-housing/bloom/pull/1532)) (Jared White)
- Photo upload and preview to the Partner Listing screens ([#1491](https://github.com/bloom-housing/bloom/pull/1491)) (Jared White)
- AG-grid sorting now is connected with the backend sorting ([#1083](https://github.com/bloom-housing/bloom/issues/1083)) (Michał Plebański)

Expand Down
16 changes: 15 additions & 1 deletion sites/public/pages/preview/listings/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react"
import React, { useState } from "react"
import Head from "next/head"
import axios from "axios"
import { Listing } from "@bloom-housing/backend-core/types"
Expand All @@ -13,6 +13,7 @@ interface ListingProps {

export default function ListingPage(props: ListingProps) {
const { listing } = props
const [previewBarVisible, setPreviewBarVisible] = useState(true)
const pageTitle = `${listing.name} - ${t("nav.siteTitle")}`
const metaDescription = t("pageDescription.listing", {
regionName: t("region.name"),
Expand All @@ -26,6 +27,19 @@ export default function ListingPage(props: ListingProps) {
<title>{pageTitle}</title>
</Head>
<MetaTags title={listing.name} image={metaImage} description={metaDescription} />
{previewBarVisible && (
<div className="pt-6 pb-4 bg-red-700 text-white font-bold text-sm">
<div className="max-w-5xl m-auto">{t("listings.listingPreviewOnly")}</div>
<button
className="-mt-8 alert-box__close text-white"
onClick={() => {
setPreviewBarVisible(false)
}}
>
&times;
</button>
</div>
)}
<ListingView listing={listing} preview={true} />
</Layout>
)
Expand Down
1 change: 1 addition & 0 deletions ui-components/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@
"includesPriorityUnits": "Includes Priority Units for %{priorities}",
"latitude": "Latitude",
"leasingAgentAddress": "Leasing Agent Address",
"listingPreviewOnly": "This is a listing preview only.",
"listingStatus": {
"active": "Open",
"pending": "Draft",
Expand Down

0 comments on commit e5898d0

Please sign in to comment.