@dcodegroup-au/page-builder 0.0.3 → 0.0.4

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.
@@ -248,7 +248,7 @@ const sites = [
248
248
  </script>
249
249
 
250
250
  <template>
251
- <div style="margin: auto 200px;">
251
+ <div>
252
252
  <div style="margin: 40px 0">
253
253
  <h1 style="margin-bottom: 20px; font-size: 50px;">Page Render</h1>
254
254
  <PageRender :page="page"/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcodegroup-au/page-builder",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/page-builder.es.js"
@@ -21,7 +21,8 @@
21
21
  <template v-for="(component, index) in parent.components">
22
22
  <div
23
23
  @click="selectComponent(sectionIndex, component, index)"
24
- class="flex cursor-pointer items-center justify-between rounded-lg py-1 pl-6 pr-2 hover:bg-gray-200"
24
+ class="flex cursor-pointer items-center justify-between rounded-lg py-1.5 pl-6 pr-2 hover:bg-gray-100"
25
+ :class="{'bg-gray-200 hover:bg-gray-200': selected?.sectionIndex === sectionIndex && selected?.componentIndex === index}"
25
26
  >
26
27
  <div class="flex flex-col">
27
28
  <div class="text-xs text-gray-600">Sub-module</div>
@@ -29,7 +30,7 @@
29
30
  {{ component.name }}
30
31
  </div>
31
32
  </div>
32
- <div class="flex items-center justify-between gap-3">
33
+ <div class="flex items-center justify-between gap-3 px-[10px]">
33
34
  <ChevronRight class="h-5 w-5" />
34
35
  </div>
35
36
  </div>
@@ -62,7 +63,7 @@
62
63
  </div>
63
64
  </template>
64
65
  <script setup>
65
- import { ref, watch, markRaw, computed } from "vue";
66
+ import { ref, markRaw, computed } from "vue";
66
67
  import ChevronRight from "@/assets/img/icons/chevron-right.svg";
67
68
  import ChevronDown from "@/assets/img/icons/chevron-down.svg";
68
69
  import Instructions from "@/components/builders/Instructions.vue";
@@ -134,19 +135,4 @@ const currentComponent = computed(() => {
134
135
 
135
136
  return componentMaps.value[selected.value?.component?.type];
136
137
  });
137
-
138
- const update = (data) => {
139
- // content.value[selected.value.sectionIndex].value.submodules[selected.value.itemIndex] = data;
140
-
141
- // axios
142
- // .post("api.admin.pages.update-content", {
143
- // attributes: content.value,
144
- // })
145
- // .then(() => {
146
- // contentUnchanged.value = true;
147
- // })
148
- // .catch((error) => {
149
- // console.error(error);
150
- // });
151
- };
152
138
  </script>
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
  </template>
10
10
  <script setup>
11
- import {ref, watch, markRaw} from "vue";
11
+ import {ref, markRaw} from "vue";
12
12
  import HeroHeader from "@/components/presenters/modules/HeroHeader.vue";
13
13
 
14
14
  const props = defineProps({
@@ -33,18 +33,7 @@
33
33
  Link #{{index + 1}}
34
34
  </div>
35
35
  <div class="relative flex items-end">
36
- <action-menu>
37
- <button
38
- class="flex min-w-[15rem] items-center gap-2 p-2.5 hover:rounded-md hover:bg-gray-100"
39
- type="button"
40
- @click="handleDeleteItem(index)"
41
- >
42
- <TrashIcon class="h-5 w-5 cursor-pointer stroke-gray-500"/>
43
- <span class="text-sm font-medium text-gray-700">
44
- Delete Link
45
- </span>
46
- </button>
47
- </action-menu>
36
+ <ActionMenu @removeItem="handleDeleteItem(index)"/>
48
37
  </div>
49
38
  </div>
50
39
  <div class="flex flex-col gap-6">
@@ -83,11 +72,9 @@
83
72
  <script setup>
84
73
  import {ref, nextTick} from "vue";
85
74
  import PlusIcon from "@/assets/img/icons/plus.svg";
86
- import TrashIcon from "@/assets/img/icons/trash-01.svg";
87
75
  import {defaultProps} from "@/components/helpers/defaultProps.js";
88
- import {createSlide} from "@/components/helpers/pageBuilderFactory";
76
+ import {createLink} from "@/components/helpers/pageBuilderFactory";
89
77
  import ActionMenu from "@/components/common/ActionMenu.vue";
90
- import VToggle from "@/components/common/VToggle.vue";
91
78
  import InputWrapper from "@/components/common/InputWrapper.vue";
92
79
  import LinkedTo from "@/components/common/LinkedTo.vue";
93
80
  import VModal from "@/components/common/VModal.vue";
@@ -107,12 +94,7 @@ function addItem() {
107
94
  if (componentData.value.data.length >= componentData.value.max_items) {
108
95
  return;
109
96
  }
110
- componentData.value.data.push({
111
- title: "",
112
- type: "site-content",
113
- url: "",
114
- openInNewTab: "",
115
- });
97
+ componentData.value.data.push(createLink());
116
98
 
117
99
  nextTick(() => {
118
100
  if (lastItemRef.value) {
@@ -1,26 +1,26 @@
1
1
  <template>
2
2
  <div class="flex justify-between pb-2">
3
3
  <p class="text-lg font-semibold text-gray-900">
4
- {{ data.component.name }}
4
+ {{ dataRef.name }}
5
5
  </p>
6
6
  </div>
7
7
  <div class="flex flex-col gap-4">
8
8
  <div class="text-gray-600 border-b border-gray-200 pb-4 text-sm">
9
- {{ props.data.component.supportive_text }}
9
+ {{ dataRef.supportive_text }}
10
10
  </div>
11
11
  <div class="flex flex-col gap-3">
12
12
  <div class="flex justify-between">
13
13
  <div class="flex flex-col gap-1">
14
14
  <div class="font-semibold text-gray-900">Sliders</div>
15
- <div class="text-sm text-gray-600">This slider can contain up to {{ data.component.max_items }} slides</div>
15
+ <div class="text-sm text-gray-600">This slider can contain up to {{ dataRef.max_items }} slides</div>
16
16
  </div>
17
17
  <div>
18
18
  <button
19
- :disabled="dataRef.data.length >= data.component.max_items"
19
+ :disabled="dataRef.data.length >= dataRef.max_items"
20
20
  @click="addItem"
21
21
  type="button"
22
22
  class="text-sm cursor-pointer flex items-center justify-center gap-1 rounded-[99px] border border-brand-600 bg-brand-500 px-3.5 py-2 font-semibold text-white hover:bg-brand-600"
23
- :class="{ 'border-gray-100 bg-gray-100 !text-gray-400 hover:bg-gray-100': dataRef.data.length >= data.component.max_items }"
23
+ :class="{ 'border-gray-100 bg-gray-100 !text-gray-400 hover:bg-gray-100': dataRef.data.length >= dataRef.max_items }"
24
24
  >
25
25
  <PlusIcon class="h-5 w-5"></PlusIcon>
26
26
  <span>Add</span>
@@ -28,9 +28,11 @@
28
28
  </div>
29
29
  </div>
30
30
  <div class="flex flex-col gap-3">
31
- <div class="flex items-center gap-4 px-2 py-1 hover:bg-gray-100 rounded-lg" v-for="(item, index) in dataRef.data">
32
- <div class="flex flex-1 cursor-pointer items-center justify-between relative">
33
- <div class="flex flex-1 flex-col" @click="edit(item, index)">
31
+ <div v-for="(item, index) in dataRef.data"
32
+ class="flex items-center gap-4 px-2 py-1 hover:bg-gray-100 rounded-lg"
33
+ :class="{'bg-gray-200 hover:bg-gray-200': openSlideStates[index]}">
34
+ <div class="flex flex-1 cursor-pointer items-center justify-between relative" @click="toggleSlide(index)">
35
+ <div class="flex flex-1 flex-col">
34
36
  <div class="text-xs text-gray-600">
35
37
  Slider #{{ index + 1 }}
36
38
  </div>
@@ -38,7 +40,7 @@
38
40
  {{ item.title }}
39
41
  </div>
40
42
  </div>
41
- <ActionMenu @removeItem="handleDeleteItem(index)" />
43
+ <ActionMenu @removeItem="handleDeleteItem(index)" :enable-edit="true" @editItem="edit(item, index)"/>
42
44
  </div>
43
45
  </div>
44
46
  </div>
@@ -62,6 +64,26 @@ const props = defineProps({
62
64
  const dataRef = ref(props.data.component);
63
65
  const modalRef = ref(null);
64
66
 
67
+ const openSlideStates = ref(JSON.parse(window.localStorage.getItem("openSlideStates")));
68
+ if (!openSlideStates.value) {
69
+ openSlideStates.value = {};
70
+
71
+ dataRef.value.data.forEach((item, index) => {
72
+ openSlideStates.value[index] = false;
73
+ });
74
+
75
+ console.log(openSlideStates)
76
+ window.localStorage.setItem("openSlideStates", JSON.stringify(openSlideStates.value));
77
+ }
78
+
79
+ const toggleSlide = (index) => {
80
+ Object.keys(openSlideStates.value).forEach((key) => {
81
+ openSlideStates.value[key] = false;
82
+ });
83
+ openSlideStates.value[index] = !openSlideStates.value[index];
84
+ window.localStorage.setItem("openSlideStates", JSON.stringify(openSlideStates.value));
85
+ };
86
+
65
87
  const addItem = () => {
66
88
  dataRef.value.data.push(createSlide());
67
89
  emit("update", dataRef.value);
@@ -2,7 +2,11 @@
2
2
  <div class="relative z-50" v-click-outside="click">
3
3
  <DotsHorizontal @click="open = !open" class="w-5 cursor-pointer text-gray-600" />
4
4
  <div class="absolute -left-60 top-6 w-[240px] rounded-lg border border-gray-200 bg-white" v-if="open">
5
- <a class="flex items-center gap-2 p-2.5 cursor-pointer h-[48px] w-full" @click="remove">
5
+ <a v-if="enableEdit" class="flex items-center gap-2 p-2.5 cursor-pointer h-[48px] w-full hover:bg-gray-100" @click="edit">
6
+ <Pencil class="w-5" />
7
+ Edit
8
+ </a>
9
+ <a class="flex items-center gap-2 p-2.5 cursor-pointer h-[48px] w-full hover:bg-gray-100" :class="{'hover:rounded-lg': !enableEdit}" @click="remove">
6
10
  <TrashIcon class="w-5" />
7
11
  Delete
8
12
  </a>
@@ -23,10 +27,18 @@ export default {
23
27
  <script setup>
24
28
  import DotsHorizontal from "@/assets/img/icons/dots-horizontal.svg";
25
29
  import TrashIcon from "@/assets/img/icons/trash-01.svg";
30
+ import Pencil from "@/assets/img/icons/pencil-01.svg";
26
31
  import { ref } from "vue";
27
32
  const open = ref(false);
28
33
  const emit = defineEmits(['removeItem']);
29
34
 
35
+ const props = defineProps({
36
+ enableEdit: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ });
41
+
30
42
  const click = () => {
31
43
  if (!open.value) {
32
44
  return;
@@ -38,4 +50,9 @@ const remove = () => {
38
50
  emit('removeItem');
39
51
  open.value = false;
40
52
  }
53
+
54
+ const edit = () => {
55
+ emit('editItem');
56
+ open.value = false;
57
+ }
41
58
  </script>
@@ -26,9 +26,9 @@ export function createSlide(overrides = {}) {
26
26
 
27
27
  export function createLink(overrides = {}) {
28
28
  return {
29
- label: "New link",
30
- url: "",
31
- open_in_new_tab: false,
29
+ title: "New link",
30
+ link_to: "",
31
+ open_in_new_tab: true,
32
32
  type: "site-content",
33
33
  ...(overrides || {}),
34
34
  };
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div class="flex h-[872px] w-full bg-navy-800 relative rounded-[48px] z-10">
3
- <Carousel :items-to-show="1" v-model="currentSlide" class="carousel" autoplay="5000" :wrap-around="true">
3
+ <Carousel :items-to-show="1" v-model="currentSlide" class="carousel w-full" :autoplay="5000" :wrap-around="true">
4
4
  <Slide v-for="(slide, index) in component.data" :key="index">
5
- <div class="lg:p-8 p-4 flex sm:w-[95%] relative">
5
+ <div class="lg:p-8 p-4 flex relative">
6
6
  <div class="lg:w-1/2 lg:pl-8 lg:pr-16 pl-4 pr-8 flex flex-col lg:mt-[218px] mt-[100px] absolute top-0 left-5 lg:relative">
7
7
  <div class="gap-2 flex z-10 mb-4">
8
8
  <a v-if="component.data.length > 1"
@@ -32,7 +32,7 @@
32
32
  v-if="slide.featured_image"
33
33
  :src="slide.featured_image"
34
34
  alt="Slide Image"
35
- class="rounded-[40px] h-[674px] lg:w-1/2 w-full object-cover"/>
35
+ class="rounded-[40px] h-[674px] max-w-[882px] lg:w-1/2 w-full object-cover"/>
36
36
  </div>
37
37
  </Slide>
38
38
  </Carousel>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="rounded-[48px]">
2
+ <div class="rounded-[48px] max-w-[1392px] 1xl:max-w-[1824px] mx-auto w-full">
3
3
  <div v-for="(component, index) in section.components">
4
4
  <component
5
5
  :is="currentComponent(component)"
@@ -6,6 +6,15 @@ module.exports = {
6
6
  ],
7
7
  theme: {
8
8
  extend: {
9
+ screens: {
10
+ sm: '640px',
11
+ md: '768px',
12
+ lg: '1024px',
13
+ xl: '1280px',
14
+ '1xl': '1440px',
15
+ '2xl': '1536px',
16
+ '3xl': '1920px',
17
+ },
9
18
  colors: {
10
19
  navy: {
11
20
  800: '#203E5A',