UNPKG

@massds/mayflower-react

Version:

React versions of Mayflower design system UI components

56 lines 2.28 kB
/** * Address module. * @module @massds/mayflower-react/Address * @requires module:@massds/mayflower-assets/scss/01-atoms/address * @requires module:@massds/mayflower-assets/scss/01-atoms/decorative-link */ import React from "react"; import PropTypes from "prop-types"; import parse from "html-react-parser"; import DecorativeLink from "../DecorativeLink/index.mjs"; const Address = props => { const address = props.address, directionLink = props.directionLink, details = props.details; return /*#__PURE__*/React.createElement("span", { className: "ma__address" }, address.streetAddress ? /*#__PURE__*/React.createElement("div", { className: "ma__address__address" }, /*#__PURE__*/React.createElement("div", { className: "ma__address__part" }, address.streetAddress), /*#__PURE__*/React.createElement("div", { className: "ma__address__part" }, address.muni + ", " + address.state + " " + address.zip)) : /*#__PURE__*/React.createElement("div", { className: "ma__address__address" }, parse(address)), details && /*#__PURE__*/React.createElement("p", { className: "ma__contact__details" }, parse(details)), directionLink && /*#__PURE__*/React.createElement("div", { className: "ma__address__directions" }, /*#__PURE__*/React.createElement(DecorativeLink, { text: "Directions", href: directionLink }))); }; Address.propTypes = process.env.NODE_ENV !== "production" ? { /** An object or string representing the address. If parsed the object contains the following: streetAddress: street number, name, if applicable apt/unit number muni: municipality/city/town state: state zip: zipcode country: country If a simple string just passed as: address: full address. */ address: PropTypes.oneOfType([PropTypes.shape({ streetAddress: PropTypes.string, muni: PropTypes.string, state: PropTypes.string, zip: PropTypes.string, country: PropTypes.string }), PropTypes.string, PropTypes.object]).isRequired, /** A link to the directions of the address. */ directionLink: PropTypes.string, /** Details around visiting the address. */ details: PropTypes.oneOfType([PropTypes.string, PropTypes.object]) } : {}; export default Address;