{"ast":null,"code":"import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Fragment as _Fragment } 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 { CityStrip } from 'components/strips/Strip';\nimport VideoLoop from 'components/VideoLoop/VideoLoop';\nimport useLocale from 'contexts/useLocale';\nimport { useIsDesktop } from 'hooks/useIsDevice';\nimport HTMLReactParser from 'html-react-parser';\nimport { getCitiesSlugs, getCityBySlug, getCityPage } from 'lib/api';\nimport { imageBuilder } from 'lib/sanity';\nimport CityMapSlice from 'slices/CityMapSlice/CityMapSlice';\nimport SliceIntro from 'slices/SliceIntro/SliceIntro';\nimport styles from './City.module.scss';\n\nconst CityPage = ({\n  lang,\n  slug,\n  title,\n  videos,\n  hero,\n  houses,\n  mapIntro,\n  open,\n  areas,\n  department,\n  housesCount,\n  availableCount,\n  searchPlaceholderShort,\n  searchPlaceholderLong\n}) => {\n  const locale = useLocale();\n  const backgroundImageURL = hero ? imageBuilder.image(hero.asset).url() : 'https://www.colivingfactory.com/assets/coresider/images/1.png';\n  const isDesktop = useIsDesktop();\n  const mapIntroStr = isDesktop ? mapIntro : mapIntro ? mapIntro.replace(':', '').trim() : '';\n  const searchPlaceholder = isDesktop ? searchPlaceholderLong : searchPlaceholderShort;\n  const housesCountHtml = locale(`houses-count`, housesCount).replace('#', `<span class='bold'>${housesCount}</span>`);\n  const availableCountHtml = locale(`available-accommodations`, availableCount).replace('#', `<span class='bold'>${availableCount}</span>`);\n  const housesAnchor = lang == 'fr' ? 'nos-habitations' : 'our-houses';\n  return /*#__PURE__*/_jsxs(_Fragment, {\n    children: [/*#__PURE__*/_jsxs(\"section\", {\n      className: cn(styles.firstSlice),\n      style: {\n        backgroundImage: !videos && backgroundImageURL ? `url(${backgroundImageURL})` : undefined\n      },\n      children: [videos && /*#__PURE__*/_jsx(VideoLoop, {\n        videos: videos\n      }), /*#__PURE__*/_jsxs(\"div\", {\n        className: styles.firstSliceContent,\n        children: [/*#__PURE__*/_jsx(\"h2\", {\n          className: cn('h--1', styles.title),\n          children: title\n        }), areas && /*#__PURE__*/_jsx(\"p\", {\n          className: cn('p--l', styles.area),\n          children: areas\n        }), /*#__PURE__*/_jsxs(\"p\", {\n          className: cn('p--l'),\n          children: [HTMLReactParser(housesCountHtml), \",\"]\n        }), /*#__PURE__*/_jsxs(\"p\", {\n          className: cn('p--l'),\n          children: [HTMLReactParser(availableCountHtml), \".\"]\n        }), isDesktop && /*#__PURE__*/_jsx(BoxButton, {\n          className: cn(styles.boxButton),\n          label: 'Découvrir les habitations',\n          href: '#' + housesAnchor,\n          fullWidth: true,\n          icon: \"right\"\n        })]\n      }), !isDesktop && /*#__PURE__*/_jsx(ArrowDownButton, {\n        htmlText: 'Découvrir les habitations',\n        className: cn(styles.arrowDownCont),\n        href: '#' + housesAnchor,\n        color: 'white'\n      })]\n    }), houses && /*#__PURE__*/_jsx(CityMapSlice, {\n      id: housesAnchor,\n      introText: mapIntroStr,\n      houses: houses,\n      searchPlaceholder: searchPlaceholder\n    }), isDesktop && /*#__PURE__*/_jsx(SliceIntro, {\n      left: true\n    })]\n  });\n};\n\nexport async function getStaticProps({\n  params: {\n    lang,\n    city\n  },\n  preview = false,\n  previewData\n}) {\n  const cityPage = await getCityPage(lang, preview);\n  const props = await getCityBySlug(city, lang, preview);\n  return {\n    props: _objectSpread(_objectSpread(_objectSpread({}, cityPage), props), {}, {\n      lang,\n      preview\n    })\n  };\n}\nexport async function getStaticPaths() {\n  const cities = await getCitiesSlugs(); // console.log('[city].js::65 cities', cities)\n\n  return {\n    paths: cities.map(page => ({\n      params: page\n    })),\n    fallback: false\n  };\n}\nexport default CityPage;","map":null,"metadata":{},"sourceType":"module"}