@dcodegroup-au/page-builder 0.5.5 → 0.5.7

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.
@@ -1,23 +1,45 @@
1
1
  <template>
2
2
  <div class="overflow-hidden mt-4">
3
- <div class="max-w-[1640px] md:px-[120px] mx-auto w-full pt-4 mb-4 flex gap-16">
4
- <div class="max-w-[800px]" v-if="section.components[0]?.title">
3
+ <div class="max-w-[1640px] md:px-[120px] mx-auto w-full pt-4 mb-4 flex gap-16 items-center" :class="{'flex-row-reverse mt-6 !mb-10': section?.revert}">
4
+ <div class="max-w-[800px] py-4" :class="{'!max-w-full w-full': section?.is_full_width }" v-if="component?.title" ref="leftColumn">
5
5
  <h3 class="text-[36px] text-gray-900 font-semibold">
6
- {{ section.components[0].title }}
6
+ {{ component.title }}
7
7
  </h3>
8
8
  <div class="all-unset">
9
- <div v-html="section.components[0].paragraph"></div>
9
+ <div v-html="component.paragraph"></div>
10
+ <div v-if="component?.hasOwnProperty('button')">
11
+ <a :href="button.url"
12
+ class="inline-flex items-center gap-2 !no-underline px-3 py-2.5 rounded-full shadow-xs text-md font-semibold !text-white bg-brand-600 hover:bg-brand-700 border border-brand-600 text-center cursor-pointer"
13
+ >{{ button.title }} <ArrowUpRight class="w-5 h-5"></ArrowUpRight></a>
14
+ </div>
10
15
  </div>
11
16
  </div>
12
- <div class="w-full rounded-[24px]" v-if="section.components[0]?.featured_image">
13
- <img :src="section.components[0]?.featured_image" alt="Feature Image" class="w-full h-full object-cover rounded-[24px]"/>
17
+ <div class="w-full max-w-[536px] rounded-[24px] overflow-hidden" v-if="component?.featured_image" ref="rightColumn">
18
+ <div v-if="component?.source_type === 'video'" class="w-full h-full relative">
19
+ <video
20
+ @click="togglePlayPause"
21
+ preload="metadata"
22
+ ref="videoPlayer"
23
+ class="h-full w-full object-cover"
24
+ >
25
+ <source :src="`${component?.featured_image}#t=2`" />
26
+ </video>
27
+ <PlayButton
28
+ v-if="!isPlaying"
29
+ class="cursor-pointer absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 group-hover:opacity-100 transition-opacity"
30
+ @click="togglePlayPause">
31
+ </PlayButton>
32
+ </div>
33
+ <img v-else :src="component?.featured_image" alt="Feature Image" class="w-full h-full object-cover rounded-[24px]"/>
14
34
  </div>
15
35
  </div>
16
36
  </div>
17
37
  </template>
18
38
 
19
39
  <script setup>
20
- import {ref} from "vue";
40
+ import {ref, onMounted, computed} from "vue";
41
+ import PlayButton from "@/assets/svg/play.svg";
42
+ import ArrowUpRight from "@/assets/img/icons/arrow-up-right.svg";
21
43
 
22
44
  const props = defineProps({
23
45
  section: {
@@ -26,6 +48,38 @@ const props = defineProps({
26
48
  },
27
49
  });
28
50
 
51
+ const leftColumn = ref(null);
52
+ const rightColumn = ref(null);
53
+
29
54
  const section = ref(props.section);
55
+ const videoPlayer = ref(null);
56
+ const isPlaying = ref(false);
57
+
58
+ const component = computed(() => {
59
+ return section.value.components[0];
60
+ })
61
+
62
+ const button = computed(() => {
63
+ return component.value?.button || {};
64
+ })
65
+
66
+ onMounted(() => {
67
+ if (leftColumn.value && rightColumn.value) {
68
+ rightColumn.value.style.height = `${leftColumn.value.offsetHeight}px`;
69
+ }
70
+ });
71
+
72
+ const togglePlayPause = () => {
73
+ if (!videoPlayer.value) {
74
+ return;
75
+ }
30
76
 
77
+ if (videoPlayer.value?.paused) {
78
+ videoPlayer.value.play();
79
+ isPlaying.value = true;
80
+ } else {
81
+ videoPlayer.value.pause();
82
+ isPlaying.value = false;
83
+ }
84
+ };
31
85
  </script>
package/vite.config.js CHANGED
@@ -21,6 +21,7 @@ export default defineConfig({
21
21
  },
22
22
  },
23
23
  build: {
24
+ minify: false,
24
25
  outDir: 'dist',
25
26
  lib: {
26
27
  entry: 'src/components/index.js', // Entry file