cmspageblocks 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmspageblocks",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "bukazu-portal-react": "^2.0.7",
32
32
  "classnames": "^2.3.1",
33
33
  "formik": "^2.2.9",
34
- "leaflet": "^1.7.1",
35
- "react-leaflet": "^3.2.2",
34
+ "react-google-maps": "^9.4.5",
36
35
  "react-responsive-carousel": "^3.2.21",
36
+ "recompose": "^0.30.0",
37
37
  "styled-components": "^5.3.1"
38
38
  },
39
39
  "devDependencies": {
package/src/Main.css.js CHANGED
@@ -9,7 +9,6 @@ flex-wrap: wrap;
9
9
  ${MEDIA.TABLET`
10
10
  margin: 80px 0 0;
11
11
  `};
12
- /* justify-content: space-between; */
13
12
  .ql-align-center {
14
13
  text-align: center;
15
14
  }
@@ -154,4 +153,39 @@ a {
154
153
  max-width: 100%;
155
154
  overflow: hidden;
156
155
  }
156
+ .page_row,
157
+ .row {
158
+ max-width: 1240px;
159
+ width: 100%;
160
+ margin: 0px auto;
161
+ padding: 16px;
162
+ width: 100%;
163
+ flex-direction: column;
164
+ @media (min-width: 676px) {
165
+ flex-direction: row;
166
+ }
167
+ &.full-width {
168
+ max-width: 100%;
169
+ padding: 0;
170
+ }
171
+
172
+ &.container-width {
173
+ margin: 0 auto;
174
+ @media (min-width: 676px) {
175
+ max-width: 640px;
176
+ }
177
+
178
+ @media (min-width: 868px) {
179
+ max-width: 820px;
180
+ }
181
+
182
+ @media (min-width: 992px) {
183
+ max-width: 960px;
184
+ }
185
+
186
+ @media (min-width: 1290px) {
187
+ max-width: 1260px;
188
+ }
189
+ }
190
+ }
157
191
  `;
@@ -1,11 +1,11 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import {Text, Image, ImageSlider, Button, Map, SearchBar} from './BlockTypes';
4
+ import {Text, Image, ImageSlider, Button, Map, SearchBar, ImageGallery, Portal} from './BlockTypes';
5
5
  import { BlockContainer } from '../Main.css'
6
6
 
7
7
  function Block({pageBlock}) {
8
- const { options, content } = pageBlock;
8
+ const { options } = pageBlock;
9
9
 
10
10
  switch(options.type) {
11
11
  case 'button': return <Wrapper options={options} key={pageBlock.id}><Button options={options} /></Wrapper>
@@ -14,11 +14,17 @@ function Block({pageBlock}) {
14
14
  case 'text': return <Wrapper options={options} key={pageBlock.id}><Text options={options} /></Wrapper>
15
15
  case 'image': return <Wrapper options={options}><Image options={options} /></Wrapper>
16
16
  case 'image_slider': return <Wrapper options={options} key={pageBlock.id}><ImageSlider options={options} /></Wrapper>
17
- default: return <Wrapper options={options}>{options.type}</Wrapper>
17
+ case 'imageGallery': return <Wrapper options={options} key={pageBlock.id}><ImageGallery options={options} /></Wrapper>
18
+ case 'bukazu_portal': return <Wrapper options={options} key={pageBlock.id}><Portal options={options} /></Wrapper>
19
+ default: return <Wrapper options={options} key={pageBlock.id}>{options.type}</Wrapper>
18
20
  }
19
21
 
20
22
  }
21
23
 
24
+ Block.propTypes = {
25
+ pageBlock: PropTypes.object.isRequired
26
+ }
27
+
22
28
  function Wrapper({ children, options }) {
23
29
  let classes = '';
24
30
  Object.entries(options.classes).forEach(element => {
@@ -3,6 +3,7 @@ import React from 'react'
3
3
  export default function({options}) {
4
4
  return (
5
5
  <img
6
+ style={{ objectFit: 'contain' }}
6
7
  src={
7
8
  options.content[0]
8
9
  ? 'https://cdn.burobork.nl/' + options.content[0].reference
@@ -0,0 +1,24 @@
1
+ import React from 'react'
2
+ import { Carousel } from 'react-responsive-carousel'
3
+ import { SliderContainer } from './ImageSlide.css'
4
+
5
+ export default function ImageGallery({options}) {
6
+ console.log({options })
7
+ return (
8
+ <SliderContainer>
9
+ <Carousel showThumbs={true} swipeable={true} emulateTouch dynamicHeight={true}>
10
+ {options.content.map(image => {
11
+ return ( <div key={image.reference}>
12
+ <img
13
+ src={
14
+ 'https://cdn.burobork.nl/' + image.reference
15
+
16
+ }
17
+ alt={image.title}
18
+ />
19
+ </div>)
20
+ })}
21
+ </Carousel>
22
+ </SliderContainer>
23
+ )
24
+ }
@@ -5,5 +5,16 @@ export const SliderContainer = styled.div`
5
5
  ul li {
6
6
  padding: 0;
7
7
  }
8
+ div img {
9
+ object-fit: cover;
10
+ }
11
+ .carousel .thumbs-wrapper {
12
+ margin: 16px;
13
+ }
14
+ max-width: 100%;
15
+ .carousel .thumbs {
16
+ padding: 0;
17
+ }
18
+
19
+ `;
8
20
 
9
- `;
@@ -5,10 +5,10 @@ import { SliderContainer } from './ImageSlide.css'
5
5
  export default function ImageSlider({options}) {
6
6
  return (
7
7
  <SliderContainer>
8
- <Carousel showThumbs={false} swipeable={true}>
8
+ <Carousel showThumbs={false} swipeable={true} dynamicHeight={true} width="100%">
9
9
  {options.content.map(slide => {
10
10
  if (!slide.active) return;
11
- return ( <div key={slide.image[0].reference}>
11
+ return ( <div key={slide.image[0].reference} style={{ height: 600 }}>
12
12
  <img
13
13
  src={
14
14
  slide
@@ -16,6 +16,7 @@ export default function ImageSlider({options}) {
16
16
  : null
17
17
  }
18
18
  alt={slide.title}
19
+ style={{ height: 600 }}
19
20
  />
20
21
  </div>)
21
22
  })}
@@ -1,25 +1,50 @@
1
- import React from "react";
2
- // import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'
1
+ import React from 'react';
2
+ import { compose, withProps } from 'recompose';
3
+ import {
4
+ withScriptjs,
5
+ withGoogleMap,
6
+ GoogleMap,
7
+ Marker,
8
+ } from 'react-google-maps';
3
9
 
4
- function HouseMap({ latitude, longitude }) {
10
+ const HouseMap = compose(
11
+ withProps({
12
+ /**
13
+ * Note: create and replace your own key in the Google console.
14
+ * https://console.developers.google.com/apis/dashboard
15
+ * The key "AIzaSyBkNaAGLEVq0YLQMi-PYEMabFeREadYe1Q" can be ONLY used in this sandbox (no forked).
16
+ */
17
+ googleMapURL:
18
+ 'https://maps.googleapis.com/maps/api/js?key=AIzaSyDnzyZ8cUsl2pcSJWUXqgj3nRg_EO1lY6Q&v=3.exp&libraries=geometry,drawing,places',
19
+ loadingElement: <div style={{ height: '100%' }} />,
20
+ containerElement: <div style={{ height: '400px', width: '100%' }} />,
21
+ mapElement: <div style={{ height: '100%' }} />,
22
+ }),
23
+ withScriptjs,
24
+ withGoogleMap
25
+ )(props => (
26
+ <GoogleMap
27
+ defaultZoom={10}
28
+ defaultCenter={{ lat: props.latitude, lng: props.longitude }}
29
+ >
30
+ {props.isMarkerShown && (
31
+ <Marker position={{ lat: props.latitude, lng: props.longitude }} />
32
+ )}
33
+ </GoogleMap>
34
+ ));
35
+
36
+ function Map({options}) {
37
+ const { location} = options
5
38
  return (
6
- <></>
7
- // <MapContainer
8
- // center={[latitude, longitude]}
9
- // zoom={10}
10
- // scrollWheelZoom={false}
11
- // >
12
- // <TileLayer
13
- // attribution='&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
14
- // url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
15
- // />
16
- // <Marker position={[latitude, longitude]}>
17
- // {/* <Popup>
18
- // A pretty CSS3 popup. <br /> Easily customizable.
19
- // </Popup> */}
20
- // </Marker>
21
- // </MapContainer>
22
- );
39
+ <HouseMap
40
+ latitude={Number(location.lat)}
41
+ longitude={Number(location.lng)}
42
+ isMarkerShown={true}
43
+ >
44
+
45
+ </HouseMap>
46
+
47
+ )
23
48
  }
24
49
 
25
- export default HouseMap;
50
+ export default Map;
@@ -1,7 +1,29 @@
1
1
  import React from 'react'
2
+ import BukazuPortal from 'bukazu-portal-react';
2
3
 
3
- export default function Portal({options}) {
4
- return (
5
- <div>Portal</div>
6
- )
4
+ // import 'bukazu-portal-react/build/index.css';
5
+
6
+ export default function Portal({ options }) {
7
+ if (typeof window !== `undefined`) {
8
+ return (
9
+ <>
10
+ {options.portal_type === 'calendar' && (
11
+ <div id="bukazu-app">
12
+ <BukazuPortal
13
+ portalCode={options.portal_code}
14
+ objectCode={options.object_code}
15
+ locale={options.language}
16
+ />
17
+ </div>
18
+ )}
19
+ {options.portal_type === 'search' && (
20
+ <div id="bukazu-app">
21
+ <BukazuPortal portalCode={options.portal_code} locale={options.language} />
22
+ </div>
23
+ )}
24
+ </>
25
+ );
26
+ } else {
27
+ return <div />;
28
+ }
7
29
  }
@@ -2,6 +2,7 @@ import Button from './Button'
2
2
  // import Form from './Form'
3
3
  import Iframe from './Iframe'
4
4
  import Image from './Image'
5
+ import ImageGallery from './ImageGallery'
5
6
  import ImageSlider from './ImageSlider'
6
7
  import Map from './Map'
7
8
  import Portal from './Portal'
@@ -11,6 +12,7 @@ import Text from './Text'
11
12
  export {
12
13
  Button,
13
14
  Image,
15
+ ImageGallery,
14
16
  ImageSlider,
15
17
  Iframe,
16
18
  Map,
@@ -1,11 +1,26 @@
1
1
  import React from 'react'
2
2
  import Block from './Block'
3
+ import classNames from 'classnames';
3
4
 
4
5
  export default function Row({ content }) {
6
+ const { options } = content;
7
+
8
+ let classes = 'page_row';
9
+ if (options.classes) {
10
+
11
+ Object.entries(options.classes).forEach(element => {
12
+ classes += ' ';
13
+ classes += element[1];
14
+ });
15
+
16
+ classes = classNames(classes, options.classes.width, options.className);
17
+ }
18
+
5
19
  return (
6
- <div className="row" style={content.options.style}>
7
- {content.page_blocks.map(block => {
8
- return <Block pageBlock={block} key={block.id} />
20
+ <div className={classes} style={content.options.style}>
21
+ {content.page_blocks.map((block,index) => {
22
+ console.log({ block });
23
+ return <Block pageBlock={block} key={index} />
9
24
  })}
10
25
  </div>
11
26
  )