@designcrowd/fe-shared-lib 1.5.32-ast-website-rename → 1.5.32-ast-dbc-1

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/index.js CHANGED
@@ -23,7 +23,6 @@ export { WEBSITE_UPGRADE_CONTEXT_TYPES } from './src/experiences/models/websiteC
23
23
 
24
24
  export { setSharedLibLocaleAsync, tr } from './src/useSharedLibTranslate';
25
25
 
26
- export { default as BrandNameEditor } from './src/atoms/components/BrandNameEditor/BrandNameEditor.vue';
27
26
  export { default as Button } from './src/atoms/components/Button/Button.vue';
28
27
  export { default as ButtonGroup } from './src/atoms/components/ButtonGroup/ButtonGroup.vue';
29
28
  export { default as Dropdown } from './src/atoms/components/Dropdown/Dropdown.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.5.32-ast-website-rename",
3
+ "version": "1.5.32-ast-dbc-1",
4
4
  "scripts": {
5
5
  "start": "run-p storybook watch:translation",
6
6
  "build": "npm run build:css --production",
@@ -34,7 +34,8 @@
34
34
  "websiteFriendlyName": "Website",
35
35
  "digitalBusinessCardFriendlyName": "Digital Business Card",
36
36
  "alreadyHaveADomainLabel": "Already have a domain?",
37
- "useExistingDomainLabel": "Use my existing domain"
37
+ "useExistingDomainLabel": "Use my existing domain",
38
+ "createTeamCardsLabel": "Create Team Cards"
38
39
  },
39
40
  "sellDomainNameList": {
40
41
  "freeDomainButtonLabel": "Free Domain",
@@ -92,11 +92,13 @@
92
92
  :has-purchased-domain="hasPurchasedDomains"
93
93
  :show-upsell-rotation-container="showUpsellRotationContainer"
94
94
  :user-currency="userCurrency"
95
+ :brand-page-type="brandPageType"
95
96
  @copy-url-clicked="onCopyUrlClick"
96
97
  @on-brand-page-url-click="onBrandPageUrlClick"
97
98
  @on-view-more-domains="onViewMore"
98
99
  @on-buy-now-clicked="onBuyNowClick"
99
100
  @on-search-text-changed="onSearchTextChanged"
101
+ @on-create-team-cards-click="onCreateTeamCardsClick"
100
102
  >
101
103
  <template #upsellContainer>
102
104
  <slot name="upsellContainer" />
@@ -289,6 +291,7 @@ export default {
289
291
  'on-slug-changed',
290
292
  'on-show-domain-modal',
291
293
  'on-use-existing-domain',
294
+ 'on-create-team-cards-click',
292
295
  ],
293
296
  setup() {
294
297
  return {
@@ -407,6 +410,9 @@ export default {
407
410
  onBrandPageUrlClick(newVal) {
408
411
  this.$emit('on-brand-page-url-click', newVal);
409
412
  },
413
+ onCreateTeamCardsClick() {
414
+ this.$emit('on-create-team-cards-click');
415
+ },
410
416
  onBuyNow(newVal) {
411
417
  this.$emit('on-buy-now-clicked', newVal);
412
418
  },
@@ -21,6 +21,7 @@
21
21
  "websiteFriendlyName": "Website",
22
22
  "digitalBusinessCardFriendlyName": "Digital Business Card",
23
23
  "alreadyHaveADomainLabel": "Already have a domain?",
24
- "useExistingDomainLabel": "Use my existing domain"
24
+ "useExistingDomainLabel": "Use my existing domain",
25
+ "createTeamCardsLabel": "Create Team Cards"
25
26
  }
26
27
  }
@@ -24,19 +24,29 @@
24
24
  data-test-brand-page-copy-input
25
25
  @on-click="onCopyUrlClick"
26
26
  />
27
- <Button
28
- :label="viewMyWebsiteLabel"
29
- :variant="isDesignCom ? 'primary' : 'primary-with-icon'"
30
- icon="chevron-right-wide"
31
- size="medium"
32
- icon-view-box="0 0 24 24"
33
- class="tw-my-4"
34
- target="_blank"
35
- rel="noopener noreferrer"
36
- :url="brandPageUrl"
37
- :full-width="isMobile"
38
- @on-click="onBrandPageUrlClick"
39
- />
27
+ <div class="tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-4 tw-my-4">
28
+ <Button
29
+ v-if="brandPageType === 'brandContact'"
30
+ :label="createTeamCardsLabel"
31
+ variant="outline"
32
+ icon-left="group"
33
+ size="medium"
34
+ :full-width="isMobile"
35
+ @on-click="onCreateTeamCardsClick"
36
+ />
37
+ <Button
38
+ :label="viewMyWebsiteLabel"
39
+ :variant="isDesignCom ? 'primary' : 'primary-with-icon'"
40
+ icon="chevron-right-wide"
41
+ size="medium"
42
+ icon-view-box="0 0 24 24"
43
+ target="_blank"
44
+ rel="noopener noreferrer"
45
+ :url="brandPageUrl"
46
+ :full-width="isMobile"
47
+ @on-click="onBrandPageUrlClick"
48
+ />
49
+ </div>
40
50
  </div>
41
51
  <div v-if="showUpsellRotationContainer" class="tw-border-t tw-border-solid tw-border-grayscale-500 tw-p-5">
42
52
  <slot name="upsellContainer" />
@@ -105,6 +115,11 @@ export default {
105
115
  required: true,
106
116
  default: undefined,
107
117
  },
118
+ brandPageType: {
119
+ type: String,
120
+ required: false,
121
+ default: '',
122
+ },
108
123
  },
109
124
  emits: [
110
125
  'copy-url-clicked',
@@ -112,6 +127,7 @@ export default {
112
127
  'on-view-more-domains',
113
128
  'on-buy-now-clicked',
114
129
  'on-search-text-changed',
130
+ 'on-create-team-cards-click',
115
131
  ],
116
132
  setup() {
117
133
  return {
@@ -119,6 +135,7 @@ export default {
119
135
  publishBrandPageModalTr,
120
136
  copyLabel: publishBrandPageModalTr('copyLabel'),
121
137
  copySuccessLabel: publishBrandPageModalTr('copySuccessLabel'),
138
+ createTeamCardsLabel: publishBrandPageModalTr('createTeamCardsLabel'),
122
139
  };
123
140
  },
124
141
  computed: {
@@ -144,6 +161,9 @@ export default {
144
161
  onBuyNowClick() {
145
162
  this.$emit('on-buy-now-clicked');
146
163
  },
164
+ onCreateTeamCardsClick() {
165
+ this.$emit('on-create-team-cards-click');
166
+ },
147
167
  },
148
168
  };
149
169
  </script>
@@ -1,75 +0,0 @@
1
- import BrandNameEditor from './BrandNameEditor.vue';
2
-
3
- export default {
4
- title: 'Components/Brand Name Editor',
5
- component: BrandNameEditor,
6
- };
7
-
8
- const data = {
9
- components: {
10
- BrandNameEditor,
11
- },
12
- data() {
13
- return {
14
- value: 'My Website',
15
- };
16
- },
17
- };
18
-
19
- export const Default = () => {
20
- return {
21
- ...data,
22
- template: `
23
- <div class="tw-bg-gray-800 tw-p-4">
24
- <BrandNameEditor v-model="value" />
25
- </div>
26
- `,
27
- };
28
- };
29
-
30
- export const DarkMode = () => {
31
- return {
32
- ...data,
33
- template: `
34
- <div class="tw-bg-gray-800 tw-p-4">
35
- <BrandNameEditor v-model="value" :dark-mode="true" />
36
- </div>
37
- `,
38
- };
39
- };
40
-
41
- export const WithPlaceholder = () => {
42
- return {
43
- components: {
44
- BrandNameEditor,
45
- },
46
- data() {
47
- return {
48
- value: '',
49
- };
50
- },
51
- template: `
52
- <div class="tw-bg-gray-800 tw-p-4">
53
- <BrandNameEditor v-model="value" :dark-mode="true" placeholder="Enter website name..." />
54
- </div>
55
- `,
56
- };
57
- };
58
-
59
- export const Empty = () => {
60
- return {
61
- components: {
62
- BrandNameEditor,
63
- },
64
- data() {
65
- return {
66
- value: '',
67
- };
68
- },
69
- template: `
70
- <div class="tw-bg-gray-800 tw-p-4">
71
- <BrandNameEditor v-model="value" />
72
- </div>
73
- `,
74
- };
75
- };
@@ -1,143 +0,0 @@
1
- <template>
2
- <div
3
- data-component="brand-name-editor"
4
- class="tw-relative tw-flex tw-gap-2 tw-flex-grow tw-items-center"
5
- :class="{
6
- 'tw-text-white': darkMode,
7
- 'tw-text-black': !darkMode,
8
- }"
9
- >
10
- <button
11
- v-if="displayMode"
12
- class="dynamic-width-input tw-truncate tw-border-transparent tw-bg-transparent tw-px-2 tw-font-bold"
13
- @click="onEditClick"
14
- >
15
- {{ modelValue?.trim() || placeholder }}
16
- </button>
17
- <input
18
- v-if="!displayMode"
19
- ref="brandNameInput"
20
- :value="modelValue"
21
- type="text"
22
- maxlength="256"
23
- class="dynamic-width-input tw-px-2 tw-bg-transparent"
24
- :class="{
25
- 'focus:tw-border-white focus:tw-shadow-md': darkMode,
26
- }"
27
- :placeholder="placeholder"
28
- @input="onInput"
29
- @blur="save"
30
- @focus="focus"
31
- @keyup.enter="($event.target as HTMLInputElement).blur()"
32
- @keyup.esc="revert"
33
- />
34
- <span
35
- ref="textWidthSpan"
36
- class="tw-absolute tw-invisible tw-max-w-full -tw-z-50 tw-top-4 tw-left-4 tw-whitespace-nowrap tw-pointer-events-none dynamic-width-input"
37
- >
38
- {{ modelValue.replace(/ /g, '&nbsp;') }}
39
- </span>
40
- <Button
41
- icon="Edit"
42
- variant="no-border"
43
- :white="darkMode"
44
- icon-size="sm"
45
- @on-click="onPencilIconClick"
46
- />
47
- </div>
48
- </template>
49
-
50
- <script setup lang="ts">
51
- import { ref, watch, nextTick, onMounted } from 'vue';
52
- import Button from '../Button/Button.vue';
53
-
54
- const props = withDefaults(
55
- defineProps<{
56
- modelValue: string;
57
- darkMode?: boolean;
58
- placeholder?: string;
59
- }>(),
60
- {
61
- darkMode: false,
62
- placeholder: '',
63
- },
64
- );
65
-
66
- const emit = defineEmits<{
67
- 'update:model-value': [value: string];
68
- save: [];
69
- }>();
70
-
71
- const brandNameInput = ref<HTMLInputElement | null>(null);
72
- const textWidthSpan = ref<HTMLSpanElement | null>(null);
73
- const displayMode = ref(true);
74
- const revertValue = ref(props.modelValue);
75
- const inputOffsetPx = 22;
76
-
77
- function resizeInput() {
78
- nextTick(() => {
79
- if (props.modelValue && brandNameInput.value && textWidthSpan.value) {
80
- brandNameInput.value.style.width = `${textWidthSpan.value.offsetWidth + inputOffsetPx}px`;
81
- } else if (brandNameInput.value) {
82
- brandNameInput.value.style.width = 'auto';
83
- }
84
- });
85
- }
86
-
87
- watch(() => displayMode.value, resizeInput);
88
- watch(() => props.modelValue, resizeInput);
89
-
90
- onMounted(() => {
91
- nextTick(() => {
92
- revertValue.value = props.modelValue;
93
- resizeInput();
94
- });
95
- });
96
-
97
- function focus() {
98
- displayMode.value = false;
99
- }
100
-
101
- function save() {
102
- displayMode.value = true;
103
- if (
104
- props.modelValue.trim() === '' ||
105
- props.modelValue !== revertValue.value
106
- ) {
107
- emit('save');
108
- revertValue.value = props.modelValue;
109
- }
110
- }
111
-
112
- function revert() {
113
- emit('update:model-value', revertValue.value);
114
- brandNameInput.value?.blur();
115
- }
116
-
117
- function onInput(event: Event) {
118
- emit('update:model-value', (event.target as HTMLInputElement).value);
119
- }
120
-
121
- function onEditClick() {
122
- displayMode.value = !displayMode.value;
123
- if (!displayMode.value) {
124
- nextTick(() => {
125
- brandNameInput.value?.focus();
126
- });
127
- }
128
- }
129
-
130
- function onPencilIconClick() {
131
- onEditClick();
132
- }
133
- </script>
134
- <style scoped>
135
- .dynamic-width-input {
136
- @apply tw-border tw-outline-none tw-truncate tw-rounded tw-w-auto tw-py-0.5 tw-my-auto tw-text-base tw-text-white tw-max-w-xs;
137
- }
138
-
139
- input.dynamic-width-input:focus {
140
- -webkit-box-shadow: 0 0 5px #d1d1d1;
141
- box-shadow: 0 0 5px #d1d1d1;
142
- }
143
- </style>