cmspageblocks 1.0.7 → 1.0.12

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.12",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "repository": {
@@ -24,17 +24,16 @@
24
24
  },
25
25
  "homepage": "https://gitlab.com/bukazu-cms/cmspageblocks#readme",
26
26
  "peerDependencies": {
27
+ "bukazu-portal-react": "^2.0.7",
27
28
  "react": "^16.14.0 || ^17.0.2",
28
- "react-dom": "^16.14.0 || ^17.0.2"
29
+ "react-dom": "^16.14.0 || ^17.0.2",
30
+ "styled-components": "^5.3.1"
29
31
  },
30
32
  "dependencies": {
31
- "bukazu-portal-react": "^2.0.7",
32
33
  "classnames": "^2.3.1",
33
34
  "formik": "^2.2.9",
34
- "leaflet": "^1.7.1",
35
- "react-leaflet": "^3.2.2",
36
- "react-responsive-carousel": "^3.2.21",
37
- "styled-components": "^5.3.1"
35
+ "google-map-react": "^2.1.10",
36
+ "react-responsive-carousel": "^3.2.21"
38
37
  },
39
38
  "devDependencies": {
40
39
  "@babel/core": "^7.15.0",
package/src/Main.css.js CHANGED
@@ -5,11 +5,9 @@ export const BlockContainer = styled.div`
5
5
  display: flex;
6
6
  flex-direction: row;
7
7
  flex-wrap: wrap;
8
- /* padding: 0 0 80px; */
9
8
  ${MEDIA.TABLET`
10
9
  margin: 80px 0 0;
11
10
  `};
12
- /* justify-content: space-between; */
13
11
  .ql-align-center {
14
12
  text-align: center;
15
13
  }
@@ -154,4 +152,38 @@ a {
154
152
  max-width: 100%;
155
153
  overflow: hidden;
156
154
  }
155
+ .page_row {
156
+ max-width: 1240px;
157
+ width: 100%;
158
+ margin: 0px auto;
159
+ padding: 16px;
160
+ width: 100%;
161
+ flex-direction: column;
162
+ @media (min-width: 676px) {
163
+ // flex-direction: row;
164
+ }
165
+ &.full-width {
166
+ max-width: 100%;
167
+ padding: 0;
168
+ }
169
+
170
+ &.container-width {
171
+ margin: 0 auto;
172
+ @media (min-width: 676px) {
173
+ max-width: 640px;
174
+ }
175
+
176
+ @media (min-width: 868px) {
177
+ max-width: 820px;
178
+ }
179
+
180
+ @media (min-width: 992px) {
181
+ max-width: 960px;
182
+ }
183
+
184
+ @media (min-width: 1290px) {
185
+ max-width: 1260px;
186
+ }
187
+ }
188
+ }
157
189
  `;
@@ -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,17 @@ 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
+ width: 100%;
16
+ .carousel .thumbs {
17
+ padding: 0;
18
+ }
19
+
20
+ `;
8
21
 
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} showStatus={false} 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,32 @@
1
- import React from "react";
2
- // import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'
1
+ import React from 'react';
2
+ import GoogleMapReact from 'google-map-react';
3
3
 
4
- function HouseMap({ latitude, longitude }) {
4
+ const isClient = typeof window !== 'undefined';
5
+
6
+ export default function GoogleMap({ options }) {
7
+ const { location } = options
8
+ const lat = parseFloat(location.lat);
9
+ const lng = parseFloat(location.lng);
5
10
  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>
11
+ <div style={{ height: '500px', width: '100%' }}>
12
+ { isClient && (
13
+ <GoogleMapReact
14
+ bootstrapURLKeys={{ key: "AIzaSyDnzyZ8cUsl2pcSJWUXqgj3nRg_EO1lY6Q" }}
15
+ defaultCenter={[lat, lng]}
16
+ defaultZoom={14}
17
+ >
18
+ <Marker
19
+ lat={lat}
20
+ lng={lng}
21
+ />
22
+ </GoogleMapReact>
23
+ )}
24
+ </div>
22
25
  );
23
26
  }
24
27
 
25
- export default HouseMap;
28
+ const Marker = () => (
29
+ <>
30
+ Marke
31
+ </>
32
+ );
@@ -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,25 @@
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
+ return <Block pageBlock={block} key={index} />
9
23
  })}
10
24
  </div>
11
25
  )