import React from 'react' import classnames from 'classnames' import { joinPresent, titleize } from '../utilities/text' import { globalProps } from '../utilities/globalProps' import Body from '../pb_body/_body' import Hashtag from '../pb_hashtag/_hashtag' import Title from '../pb_title/_title' import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props' type HomeAddressStreetProps = { aria?: { [key: string]: string }, address: string, addressCont: string, city: string, className?: string, data?: { [key: string]: string }, dark?: boolean, emphasis: "street" | "city", htmlOptions?: {[key: string]: string | number | boolean | Function}, homeId: string, houseStyle: string, homeUrl: string, newWindow: boolean, state: string, zipcode: string, territory: string, } const HomeAddressStreet = (props: HomeAddressStreetProps) => { const { address, addressCont, aria = {}, city, className, data = {}, dark = false, emphasis = 'street', htmlOptions = {}, homeId, homeUrl, newWindow, houseStyle, state, zipcode, territory, } = props const classes = (className: string, dark: boolean) => classnames( { 'pb_home_address_street': !dark, 'pb_home_address_street_dark': dark, }, globalProps(props), className ) const dataProps: { [key: string]: any } = buildDataProps(data) const ariaProps: { [key: string]: any } = buildAriaProps(aria) const htmlProps = buildHtmlProps(htmlOptions) return (
{emphasis == 'street' &&
{joinPresent([titleize(address), houseStyle], ' · ')} {titleize(addressCont)} {`${titleize(city)}, ${state} ${zipcode}`}
} {emphasis == 'city' &&
{joinPresent([titleize(address), houseStyle], ' · ')} {titleize(addressCont)}
{`${titleize(city)}, ${state}`} {` ${zipcode}`}
} {homeId && } {territory}
) } export default HomeAddressStreet