@icvdeveloper/common-module 0.0.130 → 0.0.131

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "v3plus-common-module",
3
3
  "configKey": "v3plusCommonModule",
4
- "version": "0.0.130"
4
+ "version": "0.0.131"
5
5
  }
@@ -227,3 +227,77 @@ export type PlayerAndContentClassObj = {
227
227
  sponsoredByText?: string | null;
228
228
  components?: PlayerAndContentCompObj;
229
229
  };
230
+ export type SidebarNavItemClassObj = {
231
+ link?: string | null;
232
+ };
233
+ export type SidebarClassObj = {
234
+ container?: string | null;
235
+ containerInner?: string | null;
236
+ nameContainer?: string | null;
237
+ slotContainer?: string | null;
238
+ };
239
+ export type FavoritesClassObj = {
240
+ container?: string | null;
241
+ favorite?: string | null;
242
+ favoriteName?: string | null;
243
+ favoriteDesc?: string | null;
244
+ };
245
+ export type AlertBoxClassObj = {
246
+ container?: string | null;
247
+ containerInner?: string | null;
248
+ list?: string | null;
249
+ listElement?: string | null;
250
+ };
251
+ export type TextInputClassObj = {
252
+ container?: string | null;
253
+ };
254
+ export type SwitchInputClassObj = {
255
+ container?: string | null;
256
+ containerInner?: string | null;
257
+ buttonDiv?: string | null;
258
+ slotElement?: string | null;
259
+ };
260
+ export type GenInfoCompObj = {
261
+ alertBox?: AlertBoxClassObj;
262
+ textInput?: TextInputClassObj;
263
+ switchInput?: SwitchInputClassObj;
264
+ };
265
+ export type GenInfoClassObj = {
266
+ container?: string | null;
267
+ fieldsContainer?: string | null;
268
+ fieldElement?: string | null;
269
+ fieldLabel?: string | null;
270
+ buttonContainer?: string | null;
271
+ responseMsg?: string | null;
272
+ submitButton?: string | null;
273
+ components?: GenInfoCompObj;
274
+ };
275
+ export type ProfileImageCompObj = {
276
+ alertBox?: AlertBoxClassObj;
277
+ };
278
+ export type ProfileImageClassObj = {
279
+ container?: string | null;
280
+ image?: string | null;
281
+ formContainer?: string | null;
282
+ submitButton?: string | null;
283
+ buttonSvg?: string | null;
284
+ buttonText?: string | null;
285
+ inputField?: string | null;
286
+ components?: ProfileImageCompObj;
287
+ };
288
+ export type ProfileCompObj = {
289
+ genInfo?: GenInfoClassObj;
290
+ profileImage?: ProfileImageClassObj;
291
+ favorites?: FavoritesClassObj;
292
+ modal?: modalClassObj;
293
+ sidebar?: SidebarClassObj;
294
+ sidebarNavItem?: SidebarNavItemClassObj;
295
+ };
296
+ export type ProfileClassObj = {
297
+ container?: string | null;
298
+ containerInner?: string | null;
299
+ contentContainer?: string | null;
300
+ contentContainerInner?: string | null;
301
+ contentName?: string | null;
302
+ components?: ProfileCompObj;
303
+ };
@@ -1,20 +1,52 @@
1
1
  <script lang="ts" setup>
2
2
  import { toRefs } from "vue";
3
+ import { useClassBinding } from "../../composables/useClassBinding";
4
+ import { AlertBoxClassObj } from "../../@types/components";
3
5
 
4
6
  type Props = {
5
7
  errors: Array<any>;
8
+ classObject?: AlertBoxClassObj;
6
9
  };
7
10
 
8
- const props = defineProps<Props>();
11
+ const props = withDefaults(defineProps<Props>(), {
12
+ classObject: () => {
13
+ return {
14
+ container: "",
15
+ containerInner: "",
16
+ list: "",
17
+ listElement: "",
18
+ };
19
+ },
20
+ });
9
21
 
10
- const { errors } = toRefs(props);
22
+ const { classBinding } = useClassBinding();
23
+
24
+ const { errors, classObject } = toRefs(props);
11
25
  </script>
12
26
 
13
27
  <template>
14
- <div class="text-white px-6 py-4 border-0 rounded relative mb-4 bg-red">
15
- <span class="inline-block align-middle">
16
- <ul>
17
- <li v-for="error in errors" :key="error[0]">{{ error[0] }}</li>
28
+ <div
29
+ :class="
30
+ classBinding(
31
+ classObject,
32
+ 'container',
33
+ 'text-white px-6 py-4 border-0 rounded relative mb-4 bg-red-500'
34
+ )
35
+ "
36
+ >
37
+ <span
38
+ :class="
39
+ classBinding(classObject, 'containerInner', 'inline-block align-middle')
40
+ "
41
+ >
42
+ <ul :class="classBinding(classObject, 'list', '')">
43
+ <li
44
+ v-for="error in errors"
45
+ :key="error[0]"
46
+ :class="classBinding(classObject, 'listElement', '')"
47
+ >
48
+ {{ error[0] }}
49
+ </li>
18
50
  </ul>
19
51
  </span>
20
52
  </div>
@@ -1,17 +1,27 @@
1
1
  <script lang="ts" setup>
2
2
  import { ref } from "vue";
3
+ import { SwitchInputClassObj } from "../../@types/components";
4
+ import { useClassBinding } from "../../composables/useClassBinding";
3
5
 
4
6
  interface Props {
5
7
  isEnabled: boolean;
6
8
  color?: string;
9
+ classObject?: SwitchInputClassObj;
7
10
  }
8
11
 
9
12
  const props = withDefaults(defineProps<Props>(), {
10
- isEnabled: false,
11
13
  color: "#4D4D4D",
14
+ classObject: () => {
15
+ return {
16
+ container: "",
17
+ containerInner: "",
18
+ buttonDiv: "",
19
+ };
20
+ },
12
21
  });
13
22
 
14
23
  const value = ref<boolean>(props.isEnabled);
24
+ const { color, classObject } = toRefs(props);
15
25
 
16
26
  const emit = defineEmits<{
17
27
  (event: "toggle", value: boolean): void;
@@ -21,19 +31,25 @@ const toggle = () => {
21
31
  value.value = !value.value;
22
32
  emit("toggle", value.value);
23
33
  };
34
+
35
+ const { classBinding } = useClassBinding();
24
36
  </script>
25
37
 
26
38
  <template id="switch-button">
27
- <div class="switch-button-control">
39
+ <div :class="classBinding(classObject, 'container', 'switch-button-control')">
28
40
  <div
29
- class="switch-button"
30
- :class="{ enabled: value }"
41
+ :class="[
42
+ { enabled: value },
43
+ classBinding(classObject, 'containerInner', 'switch-button'),
44
+ ]"
31
45
  :style="{ '--color': color }"
32
46
  @click="toggle"
33
47
  >
34
- <div class="button" />
48
+ <div :class="classBinding(classObject, 'buttonDiv', 'button')" />
35
49
  </div>
36
- <div class="switch-button-label">
50
+ <div
51
+ :class="classBinding(classObject, 'slotElement', 'switch-button-label')"
52
+ >
37
53
  <slot />
38
54
  </div>
39
55
  </div>
@@ -1,11 +1,21 @@
1
1
  <script lang="ts" setup>
2
+ import { useClassBinding } from "../../composables/useClassBinding";
3
+ import { TextInputClassObj } from "../../@types/components";
4
+
2
5
  type Props = {
3
6
  modelValue: string;
4
7
  placeholder: string;
5
8
  type: string;
9
+ classObject?: TextInputClassObj;
6
10
  };
7
11
 
8
- const props = defineProps<Props>();
12
+ const props = withDefaults(defineProps<Props>(), {
13
+ classObject: () => {
14
+ return {
15
+ container: "",
16
+ };
17
+ },
18
+ });
9
19
 
10
20
  const emit = defineEmits<{
11
21
  (event: "update:modelValue", value: string): void;
@@ -15,11 +25,14 @@ const emit = defineEmits<{
15
25
  const changeInput = (e) => {
16
26
  emit("update:modelValue", e.target.value);
17
27
  };
28
+
29
+ const { classBinding } = useClassBinding();
30
+ const { classObject } = toRefs(props);
18
31
  </script>
19
32
 
20
33
  <template>
21
34
  <input
22
- class="form-input px-2 py-1"
35
+ :class="classBinding(classObject, 'container', 'form-input px-2 py-1')"
23
36
  :type="type"
24
37
  :value="props.modelValue"
25
38
  :placeholder="placeholder"
@@ -3,6 +3,17 @@ import { toRefs, reactive, ref, computed } from "vue";
3
3
  import { find } from "lodash-es";
4
4
  import { storeToRefs } from "pinia";
5
5
  import { useAuthStore } from "../../store/auth";
6
+ import { useClassBinding } from "../../composables/useClassBinding";
7
+ import {
8
+ ProfileClassObj,
9
+ ProfileCompObj,
10
+ modalClassObj,
11
+ SidebarNavItemClassObj,
12
+ SidebarClassObj,
13
+ GenInfoClassObj,
14
+ ProfileImageClassObj,
15
+ FavoritesClassObj,
16
+ } from "../../@types/components";
6
17
  import Sidebar from "./components/Sidebar.vue";
7
18
  import SidebarNavItem from "./components/SidebarNavItem.vue";
8
19
  import TabGeneralInformation from "./tabs/GeneralInformation.vue";
@@ -12,6 +23,7 @@ import TabProfileImage from "./tabs/ProfileImage.vue";
12
23
  type Props = {
13
24
  visible?: boolean;
14
25
  showFavorites?: boolean;
26
+ classObject?: ProfileClassObj;
15
27
  };
16
28
 
17
29
  type Tab = {
@@ -26,10 +38,32 @@ type Tab = {
26
38
  const props = withDefaults(defineProps<Props>(), {
27
39
  visible: false,
28
40
  showFavorites: false,
41
+ classObject: () => {
42
+ return {
43
+ container: "",
44
+ containerInner: "",
45
+ contentContainer: "",
46
+ contentContainerInner: "",
47
+ contentName: "",
48
+ components: ref<ProfileCompObj>({
49
+ genInfo: ref<GenInfoClassObj>({}),
50
+ profileImage: ref<ProfileImageClassObj>({}),
51
+ favorites: ref<FavoritesClassObj>({}),
52
+ modal: ref<modalClassObj>({}),
53
+ sidebar: ref<SidebarClassObj>({}),
54
+ sidebarNavitem: ref<SidebarNavItemClassObj>({}),
55
+ }),
56
+ // components: ref<PlayerAndContentCompObj>({
57
+ // contentTabs: ref<ContentTabsClassObj>({}),
58
+ // contentArea: ref<ContentAreaClassObj>({}),
59
+ // mediaContainer: ref<MediaContainerClassObj>({}),
60
+ // }),
61
+ };
62
+ },
29
63
  });
30
64
 
31
65
  // data
32
- const { visible, showFavorites } = toRefs(props);
66
+ const { visible, showFavorites, classObject } = toRefs(props);
33
67
  const { user } = storeToRefs(useAuthStore());
34
68
  const tabs = reactive<Tab[]>([
35
69
  {
@@ -62,6 +96,8 @@ const tabs = reactive<Tab[]>([
62
96
  },
63
97
  ]);
64
98
 
99
+ const { classBinding } = useClassBinding();
100
+
65
101
  // emits
66
102
  const emit = defineEmits<{
67
103
  (event: "close"): void;
@@ -101,6 +137,20 @@ const setTab = (id: number) => {
101
137
 
102
138
  newSelected.selected = true;
103
139
  };
140
+
141
+ const tabClassObj = computed<{}>(() => {
142
+ if (selectedTab.value.name === "General Information") {
143
+ return classObject.value.components?.genInfo;
144
+ }
145
+ if (selectedTab.value.name === "Profile Image") {
146
+ return classObject.value.components?.profileImage;
147
+ }
148
+ if (selectedTab.value.name === "Favorites") {
149
+ return classObject.value.components?.favorites;
150
+ } else {
151
+ return {};
152
+ }
153
+ });
104
154
  </script>
105
155
 
106
156
  <template>
@@ -108,17 +158,29 @@ const setTab = (id: number) => {
108
158
  :use-padding="false"
109
159
  modal-size="60"
110
160
  :visible="visible"
161
+ :class-object="classObject.components?.modal"
111
162
  @trigger="closeModal"
112
163
  >
113
164
  <template #modal-body>
114
- <div class="p-2">
115
- <div class="flex flex-col md:flex-row w-full p-5">
116
- <Sidebar :name="user.name">
165
+ <div :class="classBinding(classObject, 'container', 'p-2')">
166
+ <div
167
+ :class="
168
+ classBinding(
169
+ classObject,
170
+ 'containerInner',
171
+ 'flex flex-col md:flex-row w-full p-5'
172
+ )
173
+ "
174
+ >
175
+ <Sidebar
176
+ :name="user.name"
177
+ :class-object="classObject.components?.sidebar"
178
+ >
117
179
  <SidebarNavItem
118
180
  v-for="tab in tabs"
119
181
  :id="tab.id"
120
182
  :key="tab.id"
121
- class="cursor-pointer"
183
+ :class-object="classObject.components?.sidebarNavItem"
122
184
  :active="tab.selected === true"
123
185
  @click="setTab"
124
186
  >
@@ -126,18 +188,33 @@ const setTab = (id: number) => {
126
188
  </SidebarNavItem>
127
189
  </Sidebar>
128
190
 
129
- <div class="md:w-3/4 content-container ml-0 md:ml-2">
191
+ <div
192
+ :class="
193
+ classBinding(
194
+ classObject,
195
+ 'contentContainer',
196
+ 'md:w-3/4 content-container ml-0 md:ml-2'
197
+ )
198
+ "
199
+ >
130
200
  <div
131
201
  v-if="selectedTab"
132
- class="rounded overflow-hidden shadow-lg w-full h-full p-5"
202
+ :class="
203
+ classBinding(
204
+ classObject,
205
+ 'contentContainerInner',
206
+ 'rounded overflow-hidden shadow-lg w-full h-full p-5'
207
+ )
208
+ "
133
209
  >
134
- <h2 class="mb-4">
210
+ <h2 :class="classBinding(classObject, 'contentName', 'mb-4')">
135
211
  {{ selectedTab.name }}
136
212
  </h2>
137
213
 
138
214
  <component
139
215
  :is="selectedTab.component"
140
216
  v-if="selectedTab.component && selectedTab.shouldShow"
217
+ :class-object="tabClassObj"
141
218
  :user="user"
142
219
  />
143
220
  </div>
@@ -1,25 +1,58 @@
1
1
  <script lang="ts" setup>
2
2
  import { toRefs } from "vue";
3
+ import { useClassBinding } from "../../../composables/useClassBinding";
4
+ import { SidebarClassObj } from "../../../@types/components";
3
5
 
4
6
  type Props = {
5
7
  name: string;
8
+ classObject?: SidebarClassObj;
6
9
  };
7
10
 
8
- const props = defineProps<Props>();
11
+ const props = withDefaults(defineProps<Props>(), {
12
+ classObject: () => {
13
+ return {
14
+ container: "",
15
+ containerInner: "",
16
+ nameContainer: "",
17
+ slotContainer: "",
18
+ };
19
+ },
20
+ });
21
+
22
+ const { classObject } = toRefs(props);
9
23
 
10
24
  const { name } = toRefs(props);
25
+ const { classBinding } = useClassBinding();
11
26
  </script>
12
27
 
13
28
  <template>
14
29
  <div
15
- class="md:w-1/4 rounded overflow-hidden shadow-lg md:mr-2 mt-1 mb-4 md:mb-0 md:mt-0"
30
+ :class="
31
+ classBinding(
32
+ classObject,
33
+ 'container',
34
+ 'md:w-1/4 rounded overflow-hidden shadow-lg md:mr-2 mt-1 mb-4 md:mb-0 md:mt-0'
35
+ )
36
+ "
16
37
  >
17
- <div class="px-6 py-4">
18
- <div class="font-bold text-xl mb-2">
38
+ <div :class="classBinding(classObject, 'containerInner', 'px-6 py-4')">
39
+ <div
40
+ :class="
41
+ classBinding(classObject, 'nameContainer', 'font-bold text-xl mb-2')
42
+ "
43
+ >
19
44
  {{ name }}
20
45
  </div>
21
46
 
22
- <nav class="flex-grow md:block pb-0 md:pb-4 md:overflow-y-auto">
47
+ <nav
48
+ :class="
49
+ classBinding(
50
+ classObject,
51
+ 'slotContainer',
52
+ 'flex-grow md:block pb-0 md:pb-4 md:overflow-y-auto'
53
+ )
54
+ "
55
+ >
23
56
  <slot />
24
57
  </nav>
25
58
  </div>
@@ -1,15 +1,26 @@
1
1
  <script lang="ts" setup>
2
2
  import { toRefs } from "vue";
3
+ import { SidebarNavItemClassObj } from "../../../@types/components";
4
+ import { useClassBinding } from "../../../composables/useClassBinding";
3
5
 
4
6
  type Props = {
5
7
  active: boolean;
6
8
  id: number;
9
+ classObject?: SidebarNavItemClassObj;
7
10
  };
8
11
 
9
- const props = defineProps<Props>();
12
+ const props = withDefaults(defineProps<Props>(), {
13
+ classObject: () => {
14
+ return {
15
+ link: "",
16
+ };
17
+ },
18
+ });
19
+
20
+ const { classBinding } = useClassBinding();
10
21
 
11
22
  // reactive prop data
12
- const { active, id } = toRefs(props);
23
+ const { active, id, classObject } = toRefs(props);
13
24
 
14
25
  // emits
15
26
  const emit = defineEmits<{
@@ -24,8 +35,14 @@ const onClick = () => {
24
35
 
25
36
  <template>
26
37
  <a
27
- :class="{ active: active }"
28
- class="sidebar-nav-item block px-4 py-2 mt-2 mx-1 text-black text-sm no-underline font-semibold rounded-lg hover:bg-gray-500 focus:text-white hover:text-white focus:bg-gray-500 focus:outline-none focus:shadow-outline"
38
+ :class="[
39
+ { active: active },
40
+ classBinding(
41
+ classObject,
42
+ 'link',
43
+ 'sidebar-nav-item block px-4 py-2 mt-2 mx-1 text-black text-sm no-underline font-semibold rounded-lg cursor-pointer hover:bg-gray-500 focus:text-white hover:text-white focus:bg-gray-500 focus:outline-none focus:shadow-outline'
44
+ ),
45
+ ]"
29
46
  @click="onClick"
30
47
  >
31
48
  <slot />
@@ -1,21 +1,42 @@
1
1
  <script lang="ts" setup>
2
2
  import { storeToRefs } from "pinia";
3
3
  import { useAuthStore } from "../../../store/auth";
4
+ import { useClassBinding } from "../../../composables/useClassBinding";
5
+ import { FavoritesClassObj } from "../../../@types/components";
4
6
 
7
+ type Props = {
8
+ classObject?: FavoritesClassObj;
9
+ };
10
+
11
+ const props = withDefaults(defineProps<Props>(), {
12
+ classObject: () => {
13
+ return {
14
+ container: "",
15
+ favorite: "",
16
+ favoriteName: "",
17
+ favoriteDesc: "",
18
+ };
19
+ },
20
+ });
21
+ const { classObject } = toRefs(props);
22
+ const { classBinding } = useClassBinding();
5
23
  const { user } = storeToRefs(useAuthStore());
6
24
  </script>
7
25
 
8
26
  <template>
9
- <div>
27
+ <div :class="classBinding(classObject, 'container', '')">
10
28
  <div
11
29
  v-for="favorite in user.favorites"
12
30
  :key="favorite.id"
13
- class="py-2 border-b"
31
+ :class="classBinding(classObject, 'favorite', 'py-2 border-b')"
14
32
  >
15
- <h3 class="pb-2">
33
+ <h3 :class="classBinding(classObject, 'favoriteName', 'pb-2')">
16
34
  {{ favorite.name }}
17
35
  </h3>
18
- <div v-html="favorite.description" />
36
+ <div
37
+ :class="classBinding(classObject, 'favoriteDesc', '')"
38
+ v-html="favorite.description"
39
+ />
19
40
  </div>
20
41
  </div>
21
42
  </template>
@@ -2,6 +2,40 @@
2
2
  import { storeToRefs } from "pinia";
3
3
  import { ref, reactive } from "vue";
4
4
  import { useAuthStore } from "../../../store/auth";
5
+ import {
6
+ GenInfoClassObj,
7
+ GenInfoCompObj,
8
+ AlertBoxClassObj,
9
+ TextInputClassObj,
10
+ SwitchInputClassObj,
11
+ } from "../../../@types/components";
12
+ import { useClassBinding } from "../../../composables/useClassBinding";
13
+
14
+ type Props = {
15
+ classObject?: GenInfoClassObj;
16
+ };
17
+
18
+ const props = withDefaults(defineProps<Props>(), {
19
+ classObject: () => {
20
+ return {
21
+ container: "",
22
+ fieldsContainer: "",
23
+ fieldElement: "",
24
+ fieldLabel: "",
25
+ buttonContainer: "",
26
+ responseMsg: "",
27
+ components: ref<GenInfoCompObj>({
28
+ alertBox: ref<AlertBoxClassObj>({}),
29
+ textInput: ref<TextInputClassObj>({}),
30
+ switchInput: ref<SwitchInputClassObj>({}),
31
+ }),
32
+ };
33
+ },
34
+ });
35
+
36
+ const { classBinding } = useClassBinding();
37
+
38
+ const { classObject } = toRefs(props);
5
39
 
6
40
  const { user } = storeToRefs(useAuthStore());
7
41
  const formData = reactive({
@@ -30,76 +64,157 @@ const handleForm = () => {
30
64
  wasSaved.value = true;
31
65
  })
32
66
  .catch((error) => {
33
- if (error.response === 422) {
34
- errors.value = error.response.data.errors;
67
+ console.log(error);
68
+ console.log(error.response);
69
+ console.log(error.response._data);
70
+ if (error.response.status === 422) {
71
+ errors.value = error.response._data.errors;
35
72
  }
36
73
  });
37
74
  };
38
75
  </script>
39
76
 
40
77
  <template>
41
- <div class="flex justify-between flex-col">
42
- <CommonAlertBox v-if="errors" :errors="errors" />
78
+ <div
79
+ :class="
80
+ classBinding(classObject, 'container', 'flex justify-between flex-col')
81
+ "
82
+ >
83
+ <CommonAlertBox
84
+ v-if="Object.keys(errors).length"
85
+ :errors="errors"
86
+ :class-object="classObject.components?.alertBox"
87
+ />
43
88
 
44
- <div>
45
- <div class="mb-4">
46
- <label class="block text-grey-darker text-sm font-bold mb-2">
89
+ <div :class="classBinding(classObject, 'fieldsContainer', '')">
90
+ <div :class="classBinding(classObject, 'fieldElement', 'mb-4')">
91
+ <label
92
+ :class="
93
+ classBinding(
94
+ classObject,
95
+ 'fieldLabel',
96
+ 'block text-grey-700 text-sm font-bold mb-2'
97
+ )
98
+ "
99
+ >
47
100
  Title
48
101
  </label>
49
102
  <CommonTextInput
50
103
  v-model="formData.title"
51
- class="shadow appearance-none border rounded w-full py-2 px-3 text-grey-darker leading-tight focus:outline-none focus:shadow-outline"
104
+ :class="
105
+ classBinding(
106
+ classObject.components?.textInput,
107
+ 'container',
108
+ 'shadow appearance-none border rounded w-full py-2 px-3 text-grey-700 leading-tight focus:outline-none focus:shadow-outline'
109
+ )
110
+ "
52
111
  type="text"
53
112
  placeholder="Title"
54
113
  />
55
114
  </div>
56
- <div class="mb-4">
57
- <label class="block text-grey-darker text-sm font-bold mb-2">
115
+ <div :class="classBinding(classObject, 'fieldElement', 'mb-4')">
116
+ <label
117
+ :class="
118
+ classBinding(
119
+ classObject,
120
+ 'fieldLabel',
121
+ 'block text-grey-700 text-sm font-bold mb-2'
122
+ )
123
+ "
124
+ >
58
125
  Name
59
126
  </label>
60
127
  <CommonTextInput
61
128
  v-model="formData.name"
62
- class="shadow appearance-none border rounded w-full py-2 px-3 text-grey-darker leading-tight focus:outline-none focus:shadow-outline"
129
+ :class="
130
+ classBinding(
131
+ classObject.components?.textInput,
132
+ 'container',
133
+ 'shadow appearance-none border rounded w-full py-2 px-3 text-grey-700 leading-tight focus:outline-none focus:shadow-outline'
134
+ )
135
+ "
63
136
  type="text"
64
137
  placeholder="Name"
65
138
  />
66
139
  </div>
67
- <div class="mb-4">
68
- <label class="block text-grey-darker text-sm font-bold mb-2">
140
+ <div :class="classBinding(classObject, 'fieldElement', 'mb-4')">
141
+ <label
142
+ :class="
143
+ classBinding(
144
+ classObject,
145
+ 'fieldLabel',
146
+ 'block text-grey-700 text-sm font-bold mb-2'
147
+ )
148
+ "
149
+ >
69
150
  Company
70
151
  </label>
71
152
  <CommonTextInput
72
153
  v-model="formData.company"
73
- class="shadow appearance-none border rounded w-full py-2 px-3 text-grey-darker leading-tight focus:outline-none focus:shadow-outline"
154
+ :class="
155
+ classBinding(
156
+ classObject.components?.textInput,
157
+ 'container',
158
+ 'shadow appearance-none border rounded w-full py-2 px-3 text-grey-700 leading-tight focus:outline-none focus:shadow-outline'
159
+ )
160
+ "
74
161
  type="text"
75
162
  placeholder="Company"
76
163
  />
77
164
  </div>
78
- <div class="mb-4">
79
- <label class="block text-grey-darker text-sm font-bold mb-2">
165
+ <div :class="classBinding(classObject, 'fieldElement', 'mb-4')">
166
+ <label
167
+ :class="
168
+ classBinding(
169
+ classObject,
170
+ 'fieldLabel',
171
+ 'block text-grey-700 text-sm font-bold mb-2'
172
+ )
173
+ "
174
+ >
80
175
  LinkedIn
81
176
  </label>
82
177
  <CommonTextInput
83
178
  v-model="formData.linkedin_url"
84
- class="shadow appearance-none border rounded w-full py-2 px-3 text-grey-darker leading-tight focus:outline-none focus:shadow-outline"
179
+ :class="
180
+ classBinding(
181
+ classObject.components?.textInput,
182
+ 'container',
183
+ 'shadow appearance-none border rounded w-full py-2 px-3 text-grey-700 leading-tight focus:outline-none focus:shadow-outline'
184
+ )
185
+ "
85
186
  type="text"
86
187
  placeholder="LinkedIn URL"
87
188
  />
88
189
  </div>
89
- <div class="mb-4">
90
- <label class="block text-grey-darker text-sm font-bold mb-2">
190
+ <div :class="classBinding(classObject, 'fieldElement', 'mb-4')">
191
+ <label
192
+ :class="
193
+ classBinding(
194
+ classObject,
195
+ 'fieldLabel',
196
+ 'block text-grey-700 text-sm font-bold mb-2'
197
+ )
198
+ "
199
+ >
91
200
  Twitter
92
201
  </label>
93
202
  <CommonTextInput
94
203
  v-model="formData.twitter_url"
95
- class="shadow appearance-none border rounded w-full py-2 px-3 text-grey-darker leading-tight focus:outline-none focus:shadow-outline"
204
+ :class="
205
+ classBinding(
206
+ classObject.components?.textInput,
207
+ 'container',
208
+ 'shadow appearance-none border rounded w-full py-2 px-3 text-grey-700 leading-tight focus:outline-none focus:shadow-outline'
209
+ )
210
+ "
96
211
  type="text"
97
212
  placeholder="Twitter URL"
98
213
  />
99
214
  </div>
100
-
101
- <div class="mb-4">
215
+ <div :class="classBinding(classObject, 'fieldElement', 'mb-4')">
102
216
  <CommonSwitchInput
217
+ :class-object="classObject.components?.switchInput"
103
218
  :is-enabled="formData.video_chat"
104
219
  @toggle="toggleChat"
105
220
  >
@@ -107,11 +222,22 @@ const handleForm = () => {
107
222
  </CommonSwitchInput>
108
223
  </div>
109
224
  </div>
110
- <div>
111
- <p v-if="wasSaved" class="text-green">Your profile was saved!</p>
225
+ <div :class="classBinding(classObject, 'buttonContainer', '')">
226
+ <p
227
+ v-if="wasSaved"
228
+ :class="classBinding(classObject, 'responseMsg', 'text-green-500')"
229
+ >
230
+ Your profile was saved!
231
+ </p>
112
232
 
113
233
  <button
114
- class="bg-blue hover:bg-blue-dark text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"
234
+ :class="
235
+ classBinding(
236
+ classObject,
237
+ 'submitButton',
238
+ 'bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline'
239
+ )
240
+ "
115
241
  type="button"
116
242
  @click="handleForm"
117
243
  >
@@ -2,7 +2,36 @@
2
2
  import { ref, reactive } from "vue";
3
3
  import { storeToRefs } from "pinia";
4
4
  import { useAuthStore } from "../../../store/auth";
5
+ import { useClassBinding } from "../../../composables/useClassBinding";
6
+ import {
7
+ ProfileImageClassObj,
8
+ ProfileCompObj,
9
+ AlertBoxClassObj,
10
+ } from "../../../@types/components";
5
11
 
12
+ type Props = {
13
+ classObject?: ProfileImageClassObj;
14
+ };
15
+
16
+ const props = withDefaults(defineProps<Props>(), {
17
+ classObject: () => {
18
+ return {
19
+ container: "",
20
+ image: "",
21
+ formContainer: "",
22
+ submitButton: "",
23
+ buttonSvg: "",
24
+ buttonText: "",
25
+ inputField: "",
26
+ components: ref<ProfileCompObj>({
27
+ alertBox: ref<AlertBoxClassObj>({}),
28
+ }),
29
+ };
30
+ },
31
+ });
32
+
33
+ const { classBinding } = useClassBinding();
34
+ const { classObject } = toRefs(props);
6
35
  const { user } = storeToRefs(useAuthStore());
7
36
  const wasSaved = ref<boolean>(false);
8
37
  const errors = ref<[]>([]);
@@ -26,50 +55,73 @@ const onFileChanged = (e) => {
26
55
  })
27
56
  .catch((error) => {
28
57
  if (error.response.status === 422) {
29
- errors.value = error.response.data.errors;
58
+ errors.value = error.response._data.errors;
30
59
  }
31
60
  });
32
61
  };
33
62
  </script>
34
63
 
35
64
  <template>
36
- <div>
37
- <div>
38
- <CommonAlertBox :errors="errors" />
65
+ <div :class="classBinding(classObject, 'container', '')">
66
+ <CommonAlertBox
67
+ v-if="Object.keys(errors).length"
68
+ :errors="errors"
69
+ :class-object="classObject.components?.alertBox"
70
+ />
39
71
 
40
- <img
41
- v-if="user.profile_image"
42
- :src="user.profile_image"
43
- width="100"
44
- height="100"
45
- alt=""
46
- />
72
+ <img
73
+ v-if="user.profile_image"
74
+ :src="user.profile_image"
75
+ :class="classBinding(classObject, 'image', 'w-100 h-100')"
76
+ alt=""
77
+ />
47
78
 
48
- <div class="overflow-hidden relative w-64 mt-4 mb-4">
49
- <p v-if="wasSaved" class="text-green">Your profile Image was saved!</p>
79
+ <div
80
+ :class="
81
+ classBinding(
82
+ classObject,
83
+ 'formContainer',
84
+ 'overflow-hidden relative w-64 mt-4 mb-4'
85
+ )
86
+ "
87
+ >
88
+ <p
89
+ v-if="wasSaved"
90
+ :class="classBinding(classObject, 'responseMsg', 'text-green-500')"
91
+ >
92
+ Your profile image was saved!
93
+ </p>
50
94
 
51
- <button
52
- class="rounded bg-blue hover:bg-blue-light text-white font-bold py-2 px-4 w-full inline-flex items-center"
95
+ <label
96
+ for="inputImg"
97
+ :class="
98
+ classBinding(
99
+ classObject,
100
+ 'submitButton',
101
+ 'cursor-pointer rounded bg-blue-500 text-white font-bold py-2 px-4 inline-flex items-center hover:bg-blue-700 active:bg-blue-800'
102
+ )
103
+ "
104
+ >
105
+ <svg
106
+ fill="#FFF"
107
+ :class="classBinding(classObject, 'buttonSvg', 'w-6 h-6')"
108
+ viewBox="0 0 24 24"
109
+ xmlns="http://www.w3.org/2000/svg"
110
+ >
111
+ <path d="M0 0h24v24H0z" fill="none" />
112
+ <path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" />
113
+ </svg>
114
+ <span :class="classBinding(classObject, 'buttonText', 'ml-2')"
115
+ >Change Profile Image</span
53
116
  >
54
- <svg
55
- fill="#FFF"
56
- height="18"
57
- viewBox="0 0 24 24"
58
- width="18"
59
- xmlns="http://www.w3.org/2000/svg"
60
- >
61
- <path d="M0 0h24v24H0z" fill="none" />
62
- <path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" />
63
- </svg>
64
- <span class="ml-2">Change Profile Image</span>
65
- </button>
66
- <input
67
- class="cursor-pointer absolute block py-2 px-4 w-full opacity-0 pin-r pin-t"
68
- type="file"
69
- accept="image/*"
70
- @change="onFileChanged"
71
- />
72
- </div>
117
+ </label>
118
+ <input
119
+ id="inputImg"
120
+ :class="classBinding(classObject, 'inputField', 'hidden')"
121
+ type="file"
122
+ accept="image/*"
123
+ @change="onFileChanged"
124
+ />
73
125
  </div>
74
126
  </div>
75
127
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "0.0.130",
3
+ "version": "0.0.131",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {