Skip to content
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

3030/what to expect visual updates #3063

Merged
merged 6 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion shared-helpers/src/summaryTables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const unitSummariesTable = (
listingAvailability: ListingAvailability
): StandardTableData => {
const unitSummaries = summaries?.map((unitSummary) => {
const unitPluralization = unitSummary.totalAvailable == 1 ? t("t.unit") : t("t.units")
const unitPluralization =
unitSummary.totalAvailable == 1 ? t("listings.vacantUnit") : t("listings.vacantUnits")
const minIncome =
unitSummary.minIncomeRange.min == unitSummary.minIncomeRange.max ? (
<strong>{unitSummary.minIncomeRange.min}</strong>
Expand Down
12 changes: 9 additions & 3 deletions sites/public/lib/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import {
ListingStatus,
ListingAvailability,
} from "@bloom-housing/backend-core/types"
import { t, ListingCard, ApplicationStatusType, StatusBarType } from "@bloom-housing/ui-components"
import {
t,
ListingCard,
ApplicationStatusType,
StatusBarType,
AppearanceStyleType,
} from "@bloom-housing/ui-components"
import { imageUrlFromListing, getSummariesTable } from "@bloom-housing/shared-helpers"

export const emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
Expand Down Expand Up @@ -108,9 +114,9 @@ export const getListings = (listings) => {

const generateTableSubHeader = (listing) => {
if (listing.listingAvailability === ListingAvailability.availableUnits) {
return { content: t("listings.availableUnits") }
return { content: t("listings.availableUnits"), styleType: AppearanceStyleType.success }
} else if (listing.listingAvailability === ListingAvailability.openWaitlist) {
return { content: t("listings.waitlist.open") }
return { content: t("listings.waitlist.open"), styleType: AppearanceStyleType.primary }
}
return null
}
Expand Down
5 changes: 2 additions & 3 deletions sites/public/src/ListingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,7 @@ export const ListingView = (props: ListingProps) => {
]
const unitRow = [
{
text:
listing.unitsAvailable === 1 ? t("listings.availableUnit") : t("listings.availableUnits"),
text: listing.unitsAvailable === 1 ? t("listings.vacantUnit") : t("listings.vacantUnits"),
amount: listing.unitsAvailable,
emphasized: true,
},
Expand All @@ -418,7 +417,7 @@ export const ListingView = (props: ListingProps) => {
sectionTitle:
listing.listingAvailability === ListingAvailability.openWaitlist
? t("listings.waitlist.isOpen")
: t("listings.availableUnits"),
: t("listings.vacantUnitsAvailable"),
description:
listing.listingAvailability === ListingAvailability.openWaitlist
? t("listings.waitlist.submitForWaitlist")
Expand Down
5 changes: 4 additions & 1 deletion ui-components/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,12 @@
"listings.apply.submitPaperNoDueDateNoPostMark": "%{developer} is not responsible for lost or delayed mail.",
"listings.apply.submitPaperNoDueDatePostMark": "Applications must be received by the deadline. If sending by U.S. Mail, the application must be received by mail no later than %{postmarkReceivedByDate}. Applications received after %{postmarkReceivedByDate} via mail will not be accepted. %{developer} is not responsible for lost or delayed mail.",
"listings.availableAndWaitlist": "Available Units & Open Waitlist",
"listings.availableUnitsDescription": "Applicants will be reviewed in order until all vacancies are filled.",
"listings.availableUnitsDescription": "Applicants will be reviewed in lottery rank order until all vacancies are filled.",
"listings.availableUnitsAndWaitlist": "Available units and waitlist",
"listings.availableUnitsAndWaitlistDesc": "Once applicants fill all available units, additional applicants will be placed on the waitlist for <span class='t-italic'>%{number} units</span>",
"listings.vacantUnit": "Vacant Unit",
"listings.vacantUnits": "Vacant Units",
"listings.vacantUnitsAvailable": "Vacant Units Available",
"listings.availableUnit": "Available Unit",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't change existing strings, because now our non-English keys don't match this new English string, but it looks like they are already translated. We should add a new string :)

"listings.availableUnits": "Available Units",
"listings.bath": "bath",
Expand Down
4 changes: 4 additions & 0 deletions ui-components/src/page_components/listing/ListingCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@
margin-inline-start: var(--bloom-s1);
}
}
.listings-pill_header {
margin-bottom: var(--bloom-s3);
margin-top: var(--bloom-s1);
}
27 changes: 21 additions & 6 deletions ui-components/src/page_components/listing/ListingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StackedTable, StackedTableProps } from "../../tables/StackedTable"
import { StandardTable, StandardTableProps } from "../../tables/StandardTable"
import { Heading, HeaderType } from "../../headers/Heading"
import { Tag } from "../../text/Tag"
import { AppearanceStyleType } from "../../global/AppearanceTypes"
import { AppearanceShadeType, AppearanceStyleType } from "../../global/AppearanceTypes"
import { Icon, IconFillColors } from "../../icons/Icon"
import "./ListingCard.scss"
import { NavigationContext } from "../../config/NavigationContext"
Expand All @@ -16,6 +16,7 @@ export interface CardHeader {
content: string | React.ReactNode
href?: string
customClass?: string
styleType?: AppearanceStyleType
}

export interface FooterButton {
Expand Down Expand Up @@ -74,12 +75,26 @@ const ListingCard = (props: ListingCardProps) => {
const getHeader = (
header: CardHeader | undefined,
priority: number,
style?: HeaderType,
styleType?: HeaderType,
pillStyle?: boolean,
customClass?: string
) => {
if (header && header.content) {
if (pillStyle) {
return (
<Tag
className="listings-pill_header"
pillStyle
capitalized
styleType={header.styleType}
shade={AppearanceShadeType.light}
>
{header.content}
</Tag>
)
}
return (
<Heading priority={priority} style={style} className={customClass}>
<Heading priority={priority} style={styleType} className={customClass}>
{header.href ? (
<LinkComponent className="is-card-link" href={header.href}>
{header.content}
Expand All @@ -97,8 +112,8 @@ const ListingCard = (props: ListingCardProps) => {
const getContentHeader = () => {
return (
<div className="listings-row_headers">
{getHeader(contentProps?.contentHeader, 2, "cardHeader", "order-1")}
{getHeader(contentProps?.contentSubheader, 3, "cardSubheader", "order-2")}
{getHeader(contentProps?.contentHeader, 2, "cardHeader", false, "order-1")}
{getHeader(contentProps?.contentSubheader, 3, "cardSubheader", false, "order-2")}
{cardTags && cardTags?.length > 0 && (
<div className="listings-row_tags">
{cardTags?.map((cardTag, index) => {
Expand Down Expand Up @@ -130,7 +145,7 @@ const ListingCard = (props: ListingCardProps) => {
<hr className={"mb-2"} />
)}
<div className={"listings-row_headers"}>
{getHeader(contentProps?.tableHeader, 4, "tableHeader")}
{getHeader(contentProps?.tableHeader, 4, "tableHeader", true)}
{getHeader(contentProps?.tableSubheader, 5, "tableSubheader")}
</div>
{children && children}
Expand Down
7 changes: 7 additions & 0 deletions ui-components/src/text/Tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
--pill-font-weight: 600;
--pill-text-transform: uppercase;
--pill-letter-spacing: var(--bloom-letter-spacing-ultrawide);
--pill-capitalized-text-transform: capitalized;
--pill-capitalized-letter-spacing: var(--bloom-letter-spacing-wide);

--small-pill-padding: var(--bloom-s1) var(--bloom-s3);
--small-pill-font-size: var(--bloom-font-size-2xs);
Expand Down Expand Up @@ -129,4 +131,9 @@
padding-block: var(--bloom-s2);
padding-inline: var(--bloom-s4);
}

&.is-capitalized {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

text-transform: var(--pill-capitalized-text-transform);
letter-spacing: var(--pill-capitalized-letter-spacing);
}
}
2 changes: 2 additions & 0 deletions ui-components/src/text/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "./Tag.scss"
export interface TagProps extends AppearanceProps {
className?: string
pillStyle?: boolean
capitalized?: boolean
children: React.ReactNode
fillContainer?: boolean
}
Expand All @@ -14,6 +15,7 @@ export const Tag = (props: TagProps) => {

if (props.pillStyle) tagClasses.push("is-pill")
if (props.fillContainer) tagClasses.push("fill-container")
if (props.capitalized) tagClasses.push("is-capitalized")
if (props.className) tagClasses.push(props.className)

return <span className={tagClasses.join(" ")}>{props.children}</span>
Expand Down