-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1317/listings management, building details & intro #1420
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { useContext } from "react" | ||
import { t, GridSection, ViewItem, GridCell } from "@bloom-housing/ui-components" | ||
import { ListingContext } from "../../ListingContext" | ||
|
||
const DetailBuildingDetails = () => { | ||
const listing = useContext(ListingContext) | ||
|
||
return ( | ||
<GridSection | ||
className="bg-primary-lighter" | ||
title={t("listings.sections.buildingDetailsTitle")} | ||
grid={false} | ||
inset | ||
> | ||
<GridSection columns={3}> | ||
<GridCell span={2}> | ||
<ViewItem label={t("application.contact.streetAddress")}> | ||
{listing.buildingAddress.street} | ||
</ViewItem> | ||
</GridCell> | ||
<ViewItem label={t("t.neighborhood")}>{listing.neighborhood}</ViewItem> | ||
</GridSection> | ||
<GridSection columns={6}> | ||
<GridCell span={2}> | ||
<ViewItem label={t("application.contact.city")}>{listing.buildingAddress.city}</ViewItem> | ||
</GridCell> | ||
<ViewItem label={t("application.contact.state")}>{listing.buildingAddress.state}</ViewItem> | ||
<ViewItem label={t("application.contact.zip")}>{listing.buildingAddress.zipCode}</ViewItem> | ||
|
||
<GridCell span={2}> | ||
<ViewItem label={t("listings.yearBuilt")}>{listing.yearBuilt}</ViewItem> | ||
</GridCell> | ||
</GridSection> | ||
<GridSection columns={3}> | ||
<ViewItem label={t("listings.longitude")}>{listing.buildingAddress.longitude}</ViewItem> | ||
<ViewItem label={t("listings.latitude")}>{listing.buildingAddress.latitude}</ViewItem> | ||
</GridSection> | ||
</GridSection> | ||
) | ||
} | ||
|
||
export default DetailBuildingDetails |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { useContext } from "react" | ||
import { t, GridSection, ViewItem, GridCell } from "@bloom-housing/ui-components" | ||
import { ListingContext } from "../../ListingContext" | ||
|
||
const DetailListingIntro = () => { | ||
const listing = useContext(ListingContext) | ||
|
||
return ( | ||
<GridSection | ||
className="bg-primary-lighter" | ||
title={t("listings.sections.introTitle")} | ||
grid={false} | ||
inset | ||
> | ||
<GridSection columns={3}> | ||
<GridCell span={2}> | ||
<ViewItem label={t("listings.listingName")}>{listing.name}</ViewItem> | ||
</GridCell> | ||
<ViewItem label={t("listings.developer")}>{listing.developer}</ViewItem> | ||
</GridSection> | ||
</GridSection> | ||
) | ||
} | ||
|
||
export default DetailListingIntro |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import React from "react" | ||
import { useFormContext } from "react-hook-form" | ||
import { | ||
t, | ||
GridSection, | ||
GridCell, | ||
Field, | ||
ViewItem, | ||
Select, | ||
stateKeys, | ||
} from "@bloom-housing/ui-components" | ||
|
||
const BuildingDetails = () => { | ||
const formMethods = useFormContext() | ||
|
||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
const { register } = formMethods | ||
|
||
return ( | ||
<GridSection grid={false} columns={3} separator> | ||
<span className="form-section__title">{t("listings.sections.buildingDetailsTitle")}</span> | ||
<span className="form-section__description"> | ||
{t("listings.sections.buildingDetailsSubtitle")} | ||
</span> | ||
|
||
<GridSection columns={3}> | ||
<GridCell span={2}> | ||
<Field | ||
label={t("application.contact.streetAddress")} | ||
name={"buildingAddress.street"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine either way, but I'd suggest using the |
||
id={"buildingAddress.street"} | ||
placeholder={t("application.contact.streetAddress")} | ||
register={register} | ||
/> | ||
</GridCell> | ||
<Field | ||
label={t("t.neighborhood")} | ||
name={"neighborhood"} | ||
id={"neighborhood"} | ||
placeholder={t("t.neighborhood")} | ||
register={register} | ||
/> | ||
</GridSection> | ||
<GridSection columns={6}> | ||
<GridCell span={2}> | ||
<Field | ||
label={t("application.contact.city")} | ||
name={"buildingAddress.city"} | ||
id={"buildingAddress.city"} | ||
placeholder={t("application.contact.city")} | ||
register={register} | ||
/> | ||
</GridCell> | ||
<ViewItem label={t("application.contact.state")} className="mb-0"> | ||
<Select | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control. |
||
id={`buildingAddress.state`} | ||
name={`buildingAddress.state`} | ||
label={t("application.contact.state")} | ||
labelClassName="sr-only" | ||
register={register} | ||
controlClassName="control" | ||
options={stateKeys} | ||
keyPrefix="states" | ||
errorMessage={t("errors.stateError")} | ||
/> | ||
</ViewItem> | ||
<Field | ||
label={t("application.contact.zip")} | ||
name={"buildingAddress.zipCode"} | ||
id={"buildingAddress.zipCode"} | ||
placeholder={t("application.contact.zip")} | ||
errorMessage={t("errors.zipCodeError")} | ||
register={register} | ||
/> | ||
<GridCell span={2}> | ||
<Field | ||
label={t("listings.yearBuilt")} | ||
name={"yearBuilt"} | ||
id={"yearBuilt"} | ||
placeholder={t("listings.yearBuilt")} | ||
type={"number"} | ||
register={register} | ||
/> | ||
</GridCell> | ||
</GridSection> | ||
<GridSection columns={3}> | ||
<Field | ||
label={t("listings.longitude")} | ||
name={"buildingAddress.longitude"} | ||
id={"buildingAddress.longitude"} | ||
placeholder={t("listings.longitude")} | ||
register={register} | ||
/> | ||
<Field | ||
label={t("listings.latitude")} | ||
name={"buildingAddress.latitude"} | ||
id={"buildingAddress.latitude"} | ||
placeholder={t("listings.latitude")} | ||
register={register} | ||
/> | ||
</GridSection> | ||
</GridSection> | ||
) | ||
} | ||
|
||
export default BuildingDetails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe generate year dynamically based on the current date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just temporary through the MVP :)