@designcrowd/library.brand-page 5.17.18 → 5.17.19-ast-btn-styles

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.
Files changed (63) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-DB6k-SCt.js → CreatedOnBrandCrowd-de-de-BVNCHu2U.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-DjMace5m.js → CreatedOnBrandCrowd-en-us-p5JGPJZK.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BefD6S7_.js → CreatedOnBrandCrowd-es-es-B3rvehGG.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-CCgATay-.js → CreatedOnBrandCrowd-fr-ca-Bysd3HDa.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-CCgATay-.js → CreatedOnBrandCrowd-fr-fr-Bysd3HDa.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-Bk5rXo11.js → CreatedOnBrandCrowd-pt-br-BS23K4jd.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-Bk5rXo11.js → CreatedOnBrandCrowd-pt-pt-BS23K4jd.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-Cc-kh38q.js → CreatedOnDcom-de-de-DIjn2Z4g.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-SCsgAQlO.js → CreatedOnDcom-en-us-0gCGoi3k.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-CljIh2tr.js → CreatedOnDcom-es-es-BhNHcidB.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-BxsoG_MD.js → CreatedOnDcom-fr-ca-a4_OqwIb.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-BSllWBS4.js → CreatedOnDcom-fr-fr-85rgy0k0.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-BoFJhKBu.js → CreatedOnDcom-pt-br-B2o0Anb9.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-8iLU3IhZ.js → CreatedOnDcom-pt-pt-DVZg9JdE.js} +1 -1
  15. package/lib/src/brand-page/models/logo.model.d.ts +1 -0
  16. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +1 -1
  17. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +2 -1
  18. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +1 -0
  19. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +1 -1
  20. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -1
  21. package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +1 -1
  22. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +1 -1
  23. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +1 -1
  24. package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +1 -1
  25. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +1 -1
  26. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +5 -0
  27. package/lib/src/brand-page-maker/models/button-styles-config.js +11 -12
  28. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +2 -1
  29. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +2 -1
  30. package/lib/src/clients/fabric-render-client.d.ts +7 -0
  31. package/lib/src/clients/fabric-render-client.js +6 -3
  32. package/lib/src/css/library.brand-page-brandCrowd.min.css +48 -70
  33. package/lib/src/css/library.brand-page-brandPage.min.css +48 -70
  34. package/lib/src/css/library.brand-page-designCom.min.css +48 -70
  35. package/lib/src/css/library.brand-page-preview.min.css +48 -70
  36. package/lib/src/index.mjs +1 -1
  37. package/lib/src/{lib-CgbGS9G6.js → lib-lXL8NFgQ.js} +17690 -17722
  38. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +1 -1
  39. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -1
  40. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +1 -1
  41. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +5 -3
  42. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +6 -4
  43. package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +5 -3
  44. package/lib/src/shared/logo-settings/store/editable-logo-store.js +52 -21
  45. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +5 -1
  46. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +10 -4
  47. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +1 -1
  48. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +1 -1
  49. package/package.json +1 -1
  50. package/src/brand-page/components/button/Button.vue +208 -225
  51. package/src/brand-page/components/button/ButtonIcon.vue +46 -0
  52. package/src/brand-page/components/button/ButtonStyleWrapper.vue +122 -0
  53. package/src/brand-page/models/logo.model.ts +1 -0
  54. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +2 -0
  55. package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +5 -0
  56. package/src/brand-page-maker/models/button-styles-config.ts +11 -12
  57. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +3 -0
  58. package/src/clients/fabric-render-client.ts +14 -3
  59. package/src/shared/logo-settings/store/editable-logo-store.ts +67 -18
  60. package/src/shared/style-settings/components/StyleSettings.vue +2 -7
  61. package/lib/src/brand-page/components/button/Button.mixin.d.ts +0 -86
  62. package/lib/src/brand-page/components/button/Button.mixin.js +0 -177
  63. package/src/brand-page/components/button/Button.mixin.ts +0 -192
@@ -1,87 +1,81 @@
1
1
  <template>
2
2
  <section class="tw-relative">
3
- <div
4
- v-if="
5
- (viewModel.buttonLinkType === 'page' ||
6
- viewModel.clickActionField === 'page') &&
7
- (viewModel.pageSlug || viewModel.page)
8
- "
3
+ <ButtonStyleWrapper
4
+ v-if="isPageLink && (viewModel.pageSlug || viewModel.page)"
9
5
  class="bp-button tw-mb-4"
10
- :class="{
11
- 'bp-button-arrow': isArrowIcon,
12
- 'tw-flex tw-justify-center': isBrushStrokeIcon,
13
- 'tw-min-h-14': !isPreview,
14
- 'tw-mb-6': isPaperIcon,
15
- }"
6
+ :class="{ 'tw-min-h-14': !isPreview }"
7
+ :selected-button-style-id="viewModel.styles.selectedButtonStyleId"
8
+ :icon-color="iconColor"
16
9
  >
17
- <IconV2
18
- v-if="isShowIcon"
19
- :name="isTopLeftIconName"
20
- :viewBox="isTopLeftIconViewBox"
21
- :size="isPaperIcon ? 'full' : 'button-icon'"
22
- :class="{
23
- 'tw-absolute tw-w-full bp-button-paper-top': isPaperIcon,
24
- 'bp-icon-brush-left': isBrushStrokeIcon,
25
- }"
26
- :style="{
27
- '--icon-color': iconColor,
28
- }"
29
- />
30
- <router-link
31
- class="tw-no-underline"
32
- :to="{
33
- name: routes.name,
34
- params: routes.routeParams,
35
- }"
36
- :class="{
37
- 'tw-w-full': isBrushStrokeIcon,
38
- }"
39
- >
40
- <div
10
+ <template #default="{ innerClass }">
11
+ <router-link
12
+ class="tw-no-underline"
13
+ :to="{ name: routes.name, params: routes.routeParams }"
14
+ :class="{ 'tw-w-full': isBrushStrokeIcon }"
15
+ >
16
+ <div
17
+ :title="viewModel.title"
18
+ class="c-button tw-py-4 tw-items-center"
19
+ :class="[innerClass, buttonStateClass]"
20
+ :style="buttonStyle"
21
+ @click="onClick"
22
+ >
23
+ <ButtonIcon
24
+ :view-model="viewModel"
25
+ :context="context"
26
+ :content-index="contentIndex"
27
+ :is-icon-image="isIconImage"
28
+ :icon-style="iconStyle"
29
+ >
30
+ <template v-if="$slots.icon" #icon>
31
+ <slot name="icon" />
32
+ </template>
33
+ </ButtonIcon>
34
+ <span
35
+ v-if="!viewModel.iconUrl && !$slots.icon"
36
+ class="c-button__no-icon"
37
+ />
38
+ <TextWrapper
39
+ class="c-button__label c-button__label--offset-md"
40
+ :text-style="viewModel.titleStyle"
41
+ :text="viewModel.title"
42
+ element="p"
43
+ />
44
+ </div>
45
+ </router-link>
46
+ </template>
47
+ </ButtonStyleWrapper>
48
+ <ButtonStyleWrapper
49
+ v-else
50
+ class="bp-button tw-mb-4"
51
+ :class="{ 'tw-min-h-14': !isPreview }"
52
+ :selected-button-style-id="viewModel.styles.selectedButtonStyleId"
53
+ :icon-color="iconColor"
54
+ >
55
+ <template #default="{ innerClass }">
56
+ <a
41
57
  :title="viewModel.title"
58
+ :href="href"
59
+ target="_blank"
42
60
  class="c-button tw-py-4 tw-items-center"
43
- :class="{
44
- 'c-button--disabled':
45
- (!isModalUrl && !isValidUrl) ||
46
- (isModalUrl && !isModalImageUrlValid),
47
- 'tw-cursor-pointer': isModalUrl && isModalImageUrlValid,
48
- 'tw-w-full tw-px-3': isBrushStrokeIcon,
49
- 'tw-px-5': !isBrushStrokeIcon,
50
- }"
61
+ :class="[innerClass, buttonStateClass]"
51
62
  :style="buttonStyle"
63
+ rel="noopener"
52
64
  @click="onClick"
53
65
  >
54
- <span
55
- v-if="viewModel.iconUrl"
56
- class="c-button__icon"
57
- :class="{ 'c-button__icon-img': isIconImage }"
58
- style="position: relative"
59
- :style="iconStyle"
66
+ <ButtonIcon
67
+ :view-model="viewModel"
68
+ :context="context"
69
+ :content-index="contentIndex"
70
+ :is-icon-image="isIconImage"
71
+ :icon-style="iconStyle"
60
72
  >
61
- <slot name="icon">
62
- <Media
63
- v-if="isIconImage"
64
- :image-url="viewModel.iconUrl"
65
- :color-replacements="viewModel.colorReplacements"
66
- :media-type="viewModel.mediaType"
67
- :img-classes="`c-button__icon c-button__icon-img`"
68
- :display-style="iconStyle"
69
- :size="viewModel.size"
70
- :context="context"
71
- :content-index="contentIndex"
72
- :alt="`${viewModel.name} img`"
73
- />
74
- <Icon
75
- v-else
76
- :is-fill-current="false"
77
- :name="viewModel.iconUrl"
78
- size="md"
79
- class="tw-flex"
80
- />
81
- </slot>
82
- </span>
73
+ <template v-if="$slots.icon" #icon>
74
+ <slot name="icon" />
75
+ </template>
76
+ </ButtonIcon>
83
77
  <span
84
- v-if="!viewModel.iconUrl && !$slots.icon"
78
+ v-if="!$slots.icon && !viewModel.iconUrl"
85
79
  class="c-button__no-icon"
86
80
  />
87
81
  <TextWrapper
@@ -90,116 +84,9 @@
90
84
  :text="viewModel.title"
91
85
  element="p"
92
86
  />
93
- </div>
94
- </router-link>
95
- <IconV2
96
- v-if="isShowIcon"
97
- :name="isBottomRightIconName"
98
- :viewBox="isBottomRightIconViewBox"
99
- :size="isPaperIcon ? 'full' : 'button-icon'"
100
- :class="{
101
- 'tw-absolute tw-w-full bp-button-paper-bottom': isPaperIcon,
102
- 'bp-icon-brush-right': isBrushStrokeIcon,
103
- }"
104
- :style="{
105
- '--icon-color': iconColor,
106
- }"
107
- />
108
- </div>
109
- <div
110
- v-else
111
- class="bp-button tw-mb-4"
112
- :class="{
113
- 'bp-button-arrow': isArrowIcon,
114
- 'tw-flex tw-justify-center': isBrushStrokeIcon,
115
- 'tw-min-h-14': !isPreview,
116
- 'tw-mb-6': isPaperIcon,
117
- }"
118
- >
119
- <IconV2
120
- v-if="isShowIcon"
121
- :name="isTopLeftIconName"
122
- :viewBox="isTopLeftIconViewBox"
123
- :size="isPaperIcon ? 'full' : 'button-icon'"
124
- :class="{
125
- 'tw-absolute tw-w-full bp-button-paper-top': isPaperIcon,
126
- 'bp-icon-brush-left': isBrushStrokeIcon,
127
- }"
128
- :style="{
129
- '--icon-color': iconColor,
130
- }"
131
- />
132
- <a
133
- :title="viewModel.title"
134
- :href="href"
135
- target="_blank"
136
- class="c-button tw-py-4 tw-items-center"
137
- :class="{
138
- 'c-button--disabled':
139
- (!isModalUrl && !isValidUrl) ||
140
- (isModalUrl && !isModalImageUrlValid),
141
- 'tw-cursor-pointer': isModalUrl && isModalImageUrlValid,
142
- 'tw-w-full tw-px-3': isBrushStrokeIcon,
143
- 'tw-px-5': !isBrushStrokeIcon,
144
- }"
145
- :style="buttonStyle"
146
- rel="noopener"
147
- @click="onClick"
148
- >
149
- <span
150
- v-if="viewModel.iconUrl"
151
- class="c-button__icon"
152
- :class="{ 'c-button__icon-img': isIconImage }"
153
- style="position: relative"
154
- :style="iconStyle"
155
- >
156
- <slot name="icon">
157
- <Media
158
- v-if="isIconImage"
159
- :image-url="viewModel.iconUrl"
160
- :color-replacements="viewModel.colorReplacements"
161
- :media-type="viewModel.mediaType"
162
- :img-classes="`c-button__icon c-button__icon-img`"
163
- :display-style="iconStyle"
164
- :size="viewModel.size"
165
- :context="context"
166
- :content-index="contentIndex"
167
- :alt="`${viewModel.name} img`"
168
- />
169
- <Icon
170
- v-else
171
- :is-fill-current="false"
172
- :name="viewModel.iconUrl"
173
- size="md"
174
- class="tw-flex"
175
- />
176
- </slot>
177
- </span>
178
- <span
179
- v-if="!$slots.icon && !viewModel.iconUrl"
180
- class="c-button__no-icon"
181
- />
182
- <TextWrapper
183
- class="c-button__label c-button__label--offset-md"
184
- :text-style="viewModel.titleStyle"
185
- :text="viewModel.title"
186
- element="p"
187
- />
188
- </a>
189
- <IconV2
190
- v-if="isShowIcon"
191
- :name="isBottomRightIconName"
192
- :viewBox="isBottomRightIconViewBox"
193
- :size="isPaperIcon ? 'full' : 'button-icon'"
194
- :class="{
195
- 'tw-absolute tw-w-full bp-button-paper-bottom': isPaperIcon,
196
- 'bp-icon-brush-right': isBrushStrokeIcon,
197
- }"
198
- :style="{
199
- '--icon-color': iconColor,
200
- }"
201
- />
202
- </div>
87
+ </a>
88
+ </template>
89
+ </ButtonStyleWrapper>
203
90
  <HashRouteModal
204
91
  mode="image"
205
92
  :is-hash-route-enabled="false"
@@ -211,22 +98,147 @@
211
98
  </HashRouteModal>
212
99
  </section>
213
100
  </template>
214
- <script>
215
- import { HashRouteModal, Icon as IconV2 } from '@designcrowd/fe-shared-lib';
216
- import Icon from '../icon/Icon.vue';
217
- import ButtonMixin from './Button.mixin.ts';
218
- import Media from '../media/Media.vue';
101
+
102
+ <script setup lang="ts">
103
+ import { computed, ref } from 'vue';
104
+ import { HashRouteModal } from '@designcrowd/fe-shared-lib';
105
+ import { isEmail, isTel, isURL } from '../../../utils/validator.util';
106
+ import type { BrandPageContext } from '@brand-page/models';
107
+ import type { ButtonViewModel } from '@brand-page/view-models';
108
+ import { findNavItemByPageId } from '@src/brand-page/utils/route.util';
109
+ import ButtonIcon from './ButtonIcon.vue';
110
+ import ButtonStyleWrapper from './ButtonStyleWrapper.vue';
219
111
  import TextWrapper from '../text-wrapper/TextWrapper.vue';
220
112
 
221
- export default {
222
- components: {
223
- Icon,
224
- HashRouteModal,
225
- Media,
226
- IconV2,
227
- TextWrapper,
113
+ const props = withDefaults(
114
+ defineProps<{
115
+ viewModel: ButtonViewModel;
116
+ context: BrandPageContext;
117
+ contentIndex?: number;
118
+ isPreview?: boolean;
119
+ }>(),
120
+ {
121
+ contentIndex: undefined,
122
+ isPreview: false,
228
123
  },
229
- mixins: [ButtonMixin],
124
+ );
125
+
126
+ const isModalVisible = ref(false);
127
+
128
+ const buttonStyle = computed(
129
+ (): BrandPageCssStyle => props.viewModel.styles?.style || {},
130
+ );
131
+
132
+ const isIconImage = computed((): boolean => isURL(props.viewModel.iconUrl));
133
+
134
+ const iconColor = computed(
135
+ (): string | undefined => props.viewModel.styles.style.backgroundColor,
136
+ );
137
+
138
+ const iconStyle = computed(
139
+ (): BrandPageCssStyle => props.viewModel.styles?.iconStyle || {},
140
+ );
141
+
142
+ const isModalUrl = computed(
143
+ (): boolean => props.viewModel.clickActionField === 'modalImageUrl',
144
+ );
145
+
146
+ const isModalImageUrlValid = computed((): boolean =>
147
+ isURL(props.viewModel.modalImageUrl),
148
+ );
149
+
150
+ const isBrushStrokeIcon = computed(
151
+ (): boolean =>
152
+ props.viewModel.styles.selectedButtonStyleId === 'BUTTON_STYLE_19',
153
+ );
154
+
155
+ const isPageLink = computed(
156
+ (): boolean =>
157
+ props.viewModel.buttonLinkType === 'page' ||
158
+ props.viewModel.clickActionField === 'page',
159
+ );
160
+
161
+ const isValidUrl = computed((): boolean => {
162
+ if (
163
+ props.viewModel.role === 'banner-section' ||
164
+ props.viewModel.role === 'booking-section' ||
165
+ props.viewModel.role === 'images-section'
166
+ ) {
167
+ switch (props.viewModel.buttonLinkType) {
168
+ case 'mailTo':
169
+ return isEmail(props.viewModel.url as string);
170
+ case 'tel':
171
+ return isTel(props.viewModel.url);
172
+ default:
173
+ return isURL(props.viewModel.url as string);
174
+ }
175
+ }
176
+
177
+ switch (props.viewModel.role) {
178
+ case 'email':
179
+ return isEmail(props.viewModel.url as string);
180
+ case 'phone':
181
+ return props.viewModel.url !== '';
182
+ default:
183
+ return isURL(props.viewModel.url as string);
184
+ }
185
+ });
186
+
187
+ const url = computed((): string => {
188
+ const isSectionRole =
189
+ props.viewModel.role === 'banner-section' ||
190
+ props.viewModel.role === 'booking-section' ||
191
+ props.viewModel.role === 'images-section';
192
+
193
+ const linkType = isSectionRole
194
+ ? props.viewModel.buttonLinkType
195
+ : props.viewModel.role;
196
+
197
+ switch (linkType) {
198
+ case 'mailTo':
199
+ case 'email':
200
+ return `mailto:${props.viewModel.url}`;
201
+ case 'tel':
202
+ case 'phone':
203
+ return `tel:${props.viewModel.url}`;
204
+ default:
205
+ return props.viewModel.url;
206
+ }
207
+ });
208
+
209
+ const href = computed((): string | undefined => {
210
+ if (isModalUrl.value) return undefined;
211
+ if (!isValidUrl.value) return '#';
212
+ return url.value;
213
+ });
214
+
215
+ const routes = computed(() => {
216
+ const route = findNavItemByPageId(
217
+ props.context.nav.navItems,
218
+ props.viewModel.page,
219
+ );
220
+ return {
221
+ name: route?.routeName || '',
222
+ routeParams: route?.routeParams || {},
223
+ };
224
+ });
225
+
226
+ const buttonStateClass = computed(() => ({
227
+ 'c-button--disabled':
228
+ (!isModalUrl.value && !isValidUrl.value) ||
229
+ (isModalUrl.value && !isModalImageUrlValid.value),
230
+ 'tw-cursor-pointer': isModalUrl.value && isModalImageUrlValid.value,
231
+ 'tw-w-full': isBrushStrokeIcon.value,
232
+ }));
233
+
234
+ const onClick = (): void => {
235
+ if (isModalUrl.value && isModalImageUrlValid.value) {
236
+ isModalVisible.value = true;
237
+ }
238
+ };
239
+
240
+ const onCloseModal = (): void => {
241
+ isModalVisible.value = false;
230
242
  };
231
243
  </script>
232
244
 
@@ -295,41 +307,12 @@ export default {
295
307
  height: var(--icon-h);
296
308
  }
297
309
 
298
- .bp-button-paper-bottom {
299
- @apply tw-translate-y-[-4%] tw-text-[var(--icon-color)];
300
- }
301
-
302
- .bp-button-paper-top {
303
- @apply tw-translate-y-[-10%] tw-text-[var(--icon-color)];
304
- }
305
-
306
- .bp-icon-brush-left {
307
- @apply tw-text-[var(--icon-color)] tw-w-8 tw-translate-x-[101%];
308
- }
309
- .bp-icon-brush-right {
310
- @apply tw-text-[var(--icon-color)] tw-w-8 tw-translate-x-[-4%];
311
- }
312
-
313
- .bp-icon-brush-left :deep(svg) {
314
- @apply tw-translate-x-[-99%] tw-w-auto;
315
- }
316
- .bp-icon-brush-right :deep(svg) {
317
- @apply tw-w-auto;
318
- }
319
-
320
- .bp-button-arrow,
321
- .device-wrapper--mobile .bp-button-arrow {
322
- clip-path: polygon(5% 100%, 0% 50%, 5% 0%, 95% 0%, 100% 50%, 95% 100%);
323
- }
324
310
  .device-wrapper--mobile .c-button__icon {
325
311
  margin: 0;
326
312
  margin-right: var(--icon-m-r);
327
313
  }
328
314
 
329
315
  @media (min-width: 767px) {
330
- .bp-button-arrow {
331
- clip-path: polygon(3% 100%, 0% 50%, 3% 0%, 97% 0%, 100% 50%, 97% 100%);
332
- }
333
316
  .c-button__icon {
334
317
  margin: 0 var(--icon-m-icon);
335
318
  }
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <span
3
+ v-if="viewModel.iconUrl"
4
+ class="c-button__icon"
5
+ :class="{ 'c-button__icon-img': isIconImage }"
6
+ style="position: relative"
7
+ :style="iconStyle"
8
+ >
9
+ <slot name="icon">
10
+ <Media
11
+ v-if="isIconImage"
12
+ :image-url="viewModel.iconUrl"
13
+ :color-replacements="viewModel.colorReplacements"
14
+ :media-type="viewModel.mediaType"
15
+ :img-classes="`c-button__icon c-button__icon-img`"
16
+ :display-style="iconStyle"
17
+ :size="viewModel.size"
18
+ :context="context"
19
+ :content-index="contentIndex"
20
+ :alt="`${viewModel.name} img`"
21
+ />
22
+ <Icon
23
+ v-else
24
+ :is-fill-current="false"
25
+ :name="viewModel.iconUrl"
26
+ size="md"
27
+ class="tw-flex"
28
+ />
29
+ </slot>
30
+ </span>
31
+ </template>
32
+
33
+ <script setup lang="ts">
34
+ import Icon from '../icon/Icon.vue';
35
+ import Media from '../media/Media.vue';
36
+ import type { BrandPageContext } from '@brand-page/models';
37
+ import type { ButtonViewModel } from '@brand-page/view-models';
38
+
39
+ defineProps<{
40
+ viewModel: ButtonViewModel;
41
+ context: BrandPageContext;
42
+ contentIndex?: number;
43
+ isIconImage: boolean;
44
+ iconStyle: BrandPageCssStyle;
45
+ }>();
46
+ </script>
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <div
3
+ class="bp-style-wrapper"
4
+ :class="{
5
+ 'bp-button-arrow': isArrowIcon,
6
+ 'tw-flex tw-justify-center tw-w-full': isBrushStrokeIcon,
7
+ 'tw-relative': isPaperIcon,
8
+ }"
9
+ >
10
+ <template v-if="isBrushStrokeIcon">
11
+ <IconV2
12
+ name="button-brushstroke-left"
13
+ view-box="0 0 12 20"
14
+ size="button-icon"
15
+ class="bp-icon-brush-left tw-shrink-0"
16
+ :style="brushLeftStyle"
17
+ />
18
+ <slot :inner-class="'tw-px-3'" />
19
+ <IconV2
20
+ name="button-brushstroke-right"
21
+ view-box="2 0 12 20"
22
+ size="button-icon"
23
+ class="bp-icon-brush-right tw-shrink-0"
24
+ :style="brushRightStyle"
25
+ />
26
+ </template>
27
+ <template v-else-if="isPaperIcon">
28
+ <IconV2
29
+ name="button-paper-top"
30
+ view-box="41 0 120 16"
31
+ size="auto"
32
+ class="tw-absolute tw-w-full bp-button-paper-top"
33
+ :style="paperIconStyle"
34
+ />
35
+ <slot :inner-class="'tw-px-5'" />
36
+ <IconV2
37
+ name="button-paper-bottom"
38
+ view-box="41 0 120 16"
39
+ size="auto"
40
+ class="tw-absolute tw-w-full bp-button-paper-bottom"
41
+ :style="paperIconStyle"
42
+ />
43
+ </template>
44
+ <template v-else>
45
+ <slot :inner-class="'tw-px-5'" />
46
+ </template>
47
+ </div>
48
+ </template>
49
+
50
+ <script setup lang="ts">
51
+ import { computed } from 'vue';
52
+ import { Icon as IconV2 } from '@designcrowd/fe-shared-lib';
53
+
54
+ const props = defineProps<{
55
+ selectedButtonStyleId?: string;
56
+ iconColor?: string;
57
+ }>();
58
+
59
+ const isPaperIcon = computed(
60
+ () => props.selectedButtonStyleId === 'BUTTON_STYLE_21',
61
+ );
62
+ const isArrowIcon = computed(
63
+ () => props.selectedButtonStyleId === 'BUTTON_STYLE_20',
64
+ );
65
+ const isBrushStrokeIcon = computed(
66
+ () => props.selectedButtonStyleId === 'BUTTON_STYLE_19',
67
+ );
68
+
69
+ const paperIconStyle = computed(() => ({
70
+ '--icon-color': props.iconColor,
71
+ }));
72
+
73
+ const brushLeftStyle = computed(() => ({
74
+ '--icon-color': props.iconColor,
75
+ color: props.iconColor,
76
+ width: '2rem',
77
+ transform: 'translateX(101%)',
78
+ }));
79
+
80
+ const brushRightStyle = computed(() => ({
81
+ '--icon-color': props.iconColor,
82
+ color: props.iconColor,
83
+ width: '2rem',
84
+ transform: 'translateX(-4%)',
85
+ }));
86
+ </script>
87
+
88
+ <style scoped>
89
+ .bp-button-paper-top {
90
+ @apply tw-translate-y-[-10%] tw-text-[var(--icon-color)];
91
+ }
92
+
93
+ .bp-button-paper-bottom {
94
+ @apply tw-translate-y-[-4%] tw-text-[var(--icon-color)];
95
+ }
96
+
97
+ .bp-button-paper-top :deep(svg),
98
+ .bp-button-paper-bottom :deep(svg) {
99
+ width: 100%;
100
+ height: auto;
101
+ }
102
+
103
+ .bp-icon-brush-left :deep(svg) {
104
+ transform: translateX(-99%);
105
+ width: auto;
106
+ }
107
+
108
+ .bp-icon-brush-right :deep(svg) {
109
+ width: auto;
110
+ }
111
+
112
+ .bp-button-arrow,
113
+ .device-wrapper--mobile .bp-button-arrow {
114
+ clip-path: polygon(5% 100%, 0% 50%, 5% 0%, 95% 0%, 100% 50%, 95% 100%);
115
+ }
116
+
117
+ @media (min-width: 767px) {
118
+ .bp-button-arrow {
119
+ clip-path: polygon(3% 100%, 0% 50%, 3% 0%, 97% 0%, 100% 50%, 97% 100%);
120
+ }
121
+ }
122
+ </style>
@@ -30,6 +30,7 @@ export interface LogoTemplateImageModel {
30
30
  logoTemplateToken: string;
31
31
  logoTemplateText: string;
32
32
  logoTemplateVersion: number;
33
+ layout?: string;
33
34
  }
34
35
 
35
36
  export const EMPTY_LOGO_IMAGE_MODEL: Readonly<LogoImageModel> = {
@@ -71,6 +71,7 @@ export interface BrandPageMakerViewModel {
71
71
  brandPageType?: BrandPageType;
72
72
  businessName?: string;
73
73
  industry?: string;
74
+ layout?: string;
74
75
  }
75
76
 
76
77
  const RESIZE_DEBOUNCE_WAIT_IN_MS = 100;
@@ -227,6 +228,7 @@ export default defineComponent({
227
228
  brandPageType: this.viewModel.brandPageType,
228
229
  businessName: this.viewModel.businessName,
229
230
  industry: this.viewModel.industry,
231
+ layout: this.viewModel.layout,
230
232
  logoVariationImageUrls: this.viewModel.logoVariationImageUrls,
231
233
  shopConfigData,
232
234
  });
@@ -274,6 +274,11 @@ export default defineComponent({
274
274
  },
275
275
  deep: true,
276
276
  },
277
+ logoImageBase64Url() {
278
+ if (this.isAdmin) {
279
+ this.updateViewModel();
280
+ }
281
+ },
277
282
  previewImageUrl() {
278
283
  // Reset loading state whenever the preview URL changes
279
284
  if (!this.isAdmin) {