{"ast":null,"code":"import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport cn from 'classnames';\nimport { ArrowDownButton } from 'components/gui/Arrow';\nimport BoxButton from 'components/gui/BoxButton';\nimport CustomBlockContent from 'components/gui/CustomBlockContent';\nimport useLocale from 'contexts/useLocale';\nimport styles from './Strip.module.scss';\nimport HTMLReactParser from 'html-react-parser';\nimport { forwardRef } from 'react';\n\nconst Strip = ({\n  style,\n  className,\n  title,\n  intro,\n  blocks,\n  button,\n  downHref\n}, ref) => {\n  return /*#__PURE__*/_jsxs(\"div\", {\n    ref: ref,\n    className: cn(styles.strip, className),\n    style: _objectSpread({}, style),\n    children: [/*#__PURE__*/_jsx(\"div\", {\n      children: /*#__PURE__*/_jsx(\"h2\", {\n        className: cn('h--1', styles.title),\n        children: title\n      })\n    }), /*#__PURE__*/_jsxs(\"div\", {\n      children: [intro && /*#__PURE__*/_jsx(\"strong\", {\n        className: cn('p--l', styles.intro),\n        children: intro\n      }), blocks && /*#__PURE__*/_jsx(CustomBlockContent, {\n        className: cn('p--m', styles.text),\n        blocks: blocks\n      }), button && /*#__PURE__*/_jsx(BoxButton, {\n        className: cn(styles.button),\n        label: button.label,\n        fullWidth: true,\n        onClick: () => {},\n        icon: \"right\"\n      })]\n    }), downHref && /*#__PURE__*/_jsx(ArrowDownButton, {\n      href: downHref\n    })]\n  });\n};\n\nexport default /*#__PURE__*/forwardRef(Strip);\nexport const HouseStrip = ({\n  style,\n  className,\n  title,\n  blocks,\n  accommodations,\n  // accommodationsCount,\n  // availableCount,\n  // cheapest,\n  area,\n  surface //downHref,\n\n}) => {\n  const locale = useLocale();\n  const accommodationsCount = accommodations.length;\n  const availableCount = accommodations.reduce((acc, curr) => acc + (curr.available ? 1 : 0), 0);\n  const cheapest = accommodations.reduce((acc, curr) => {\n    const price = parseInt(curr.price.replace('€', '')); //.replace('$', '').replace(' ', ''))\n\n    return price < acc ? price : acc;\n  }, 9999);\n  const accommodationsCountHtml = locale(`accommodations-count`, accommodationsCount).replace('#', `<span class='bold'>${accommodationsCount}</span>`);\n  const availableCountHtml = locale(`available-accommodations`, availableCount).replace('#', `<span class='bold'>${availableCount}</span>`);\n  const cheapestHtml = locale(`price-from`).replace('#', `<span class='bold'>${cheapest}€</span>`);\n  return /*#__PURE__*/_jsxs(\"div\", {\n    className: cn(styles.strip, styles.houseStrip, className),\n    style: _objectSpread({}, style),\n    children: [/*#__PURE__*/_jsx(\"div\", {\n      children: /*#__PURE__*/_jsx(\"h2\", {\n        className: cn('h--1', styles.title),\n        children: title\n      })\n    }), /*#__PURE__*/_jsxs(\"div\", {\n      children: [/*#__PURE__*/_jsxs(\"div\", {\n        className: cn(styles.houseInfosGrid),\n        children: [/*#__PURE__*/_jsx(\"div\", {\n          style: {\n            flex: 1\n          },\n          children: area && area.split('\\n').map((line, i) => /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: line\n          }, i))\n        }), /*#__PURE__*/_jsxs(\"div\", {\n          style: {\n            flex: 0.7\n          },\n          children: [/*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: HTMLReactParser(accommodationsCountHtml)\n          }), /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: HTMLReactParser(availableCountHtml)\n          })]\n        })]\n      }), /*#__PURE__*/_jsxs(\"div\", {\n        className: cn(styles.houseInfosGrid),\n        children: [/*#__PURE__*/_jsxs(\"div\", {\n          style: {\n            flex: 1\n          },\n          children: [/*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: locale('house-surface-area')\n          }), /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m', 'bold'),\n            children: surface\n          })]\n        }), /*#__PURE__*/_jsx(\"div\", {\n          style: {\n            flex: 0.7\n          },\n          children: /*#__PURE__*/_jsx(\"p\", {\n            className: cn('p--m'),\n            children: HTMLReactParser(cheapestHtml)\n          })\n        })]\n      }), blocks && /*#__PURE__*/_jsx(CustomBlockContent, {\n        className: cn('p--m', styles.text),\n        blocks: blocks\n      }), /*#__PURE__*/_jsx(BoxButton, {\n        className: cn(styles.button),\n        label: locale('join-house').replace('{house}', title),\n        fullWidth: true,\n        onClick: () => {},\n        icon: \"down\"\n      }), /*#__PURE__*/_jsx(BoxButton, {\n        className: cn(styles.button),\n        label: locale('share'),\n        fullWidth: true,\n        onClick: () => {},\n        icon: \"right\"\n      })]\n    })]\n  });\n};\nexport const CityStrip = ({\n  style,\n  className,\n  title,\n  blocks,\n  accommodationsCount,\n  housesCount,\n  availableCount,\n  downHref\n}) => {\n  const locale = useLocale(); // const accommodationsCountHtml = locale(`accommodations-count-${accommodationsCount == 1 ? 'single' : 'plural'}`)\n  //    .replace('#', `<span class='bold'>${accommodationsCount}</span>`)\n\n  const housesCountHtml = locale(`houses-count`, housesCount).replace('#', `<span class='bold'>${housesCount}</span>`); // const availableCountHtml = locale(`available-${availableCount == 1 ? 'single' : 'plural'}`)\n  //    .replace('#', `<span class='bold'>${availableCount}</span>`)\n\n  const availableCountHtml = locale(`available-accommodations`, availableCount).replace('#', `<span class='bold'>${availableCount}</span>`);\n  return /*#__PURE__*/_jsxs(\"div\", {\n    className: cn(styles.strip, styles.cityStrip, className),\n    style: _objectSpread({}, style),\n    children: [/*#__PURE__*/_jsx(\"div\", {\n      children: /*#__PURE__*/_jsx(\"h2\", {\n        className: cn('h--1', styles.title),\n        children: title\n      })\n    }), /*#__PURE__*/_jsxs(\"div\", {\n      children: [/*#__PURE__*/_jsxs(\"div\", {\n        className: cn(styles.cityInfosGrid),\n        children: [/*#__PURE__*/_jsx(\"p\", {\n          className: cn('p--m'),\n          children: HTMLReactParser(housesCountHtml)\n        }), /*#__PURE__*/_jsx(\"p\", {\n          className: cn('p--m'),\n          children: HTMLReactParser(availableCountHtml)\n        })]\n      }), blocks && /*#__PURE__*/_jsx(CustomBlockContent, {\n        className: cn('p--m', styles.text),\n        blocks: blocks\n      }), downHref && /*#__PURE__*/_jsx(BoxButton, {\n        className: cn(styles.button),\n        label: locale('Découvrir les habitations.'),\n        fullWidth: true,\n        href: downHref,\n        icon: \"down\"\n      })]\n    })]\n  });\n};","map":null,"metadata":{},"sourceType":"module"}