@designcrowd/fe-shared-lib 1.2.0-kp-1 → 1.2.0-ml-jj-2

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.
@@ -32,7 +32,7 @@
32
32
  <Button
33
33
  :classes="searchButtonClasses"
34
34
  variant="primary"
35
- label="Search"
35
+ :label="searchButtonLabel"
36
36
  :disabled="false"
37
37
  @on-click="onSearchBarClick"
38
38
  />
@@ -41,15 +41,11 @@
41
41
  </div>
42
42
  </template>
43
43
  <script>
44
- import Button from '../../../../src/atoms/components/Button/Button.vue';
45
- import TextInput from '../../../../src/atoms/components/TextInput/TextInput.vue';
44
+ import Button from '../../../atoms/components/Button/Button.vue';
45
+ import TextInput from '../../../atoms/components/TextInput/TextInput.vue';
46
+ import useSellDomainNameSearchContent from './UseSellDomainNameSearchContent';
46
47
 
47
- import {
48
- sellDomainNameMinSearchTextLength,
49
- sellDomainNameSearchBarLabel,
50
- sellDomainNameSearchBarPlaceholder,
51
- sellDomainNameSearchBarPreText,
52
- } from '../../constants/sell-domain-name-constants';
48
+ import { sellDomainNameMinSearchTextLength } from '../../constants/sell-domain-name-constants';
53
49
 
54
50
  export default {
55
51
  components: {
@@ -79,14 +75,27 @@ export default {
79
75
  type: Boolean,
80
76
  required: false,
81
77
  },
78
+ contentOverride: {
79
+ type: Object,
80
+ required: false,
81
+ default: null,
82
+ },
82
83
  },
83
84
  emits: ['onSearch', 'onSearchTextInputChange'],
85
+ setup(props) {
86
+ const contentProvider = useSellDomainNameSearchContent(props.contentOverride);
87
+ const content = contentProvider.getContent();
88
+
89
+ return {
90
+ searchButtonLabel: content.searchButtonLabel,
91
+ searchBarLabel: content.searchBarLabel,
92
+ searchBarPlaceholder: content.searchBarPlaceholder,
93
+ searchBarPreText: content.searchBarPreText,
94
+ };
95
+ },
84
96
  data() {
85
97
  return {
86
- searchBarLabel: sellDomainNameSearchBarLabel,
87
- searchBarPlaceholder: sellDomainNameSearchBarPlaceholder,
88
98
  searchText: this.initialSearchTerm ?? '',
89
- searchBarPreText: sellDomainNameSearchBarPreText,
90
99
  };
91
100
  },
92
101
  computed: {
@@ -0,0 +1,33 @@
1
+ import {
2
+ sellDomainNameSearchBarLabel,
3
+ sellDomainNameSearchBarPlaceholder,
4
+ sellDomainNameSearchBarPreText,
5
+ } from '../../constants/sell-domain-name-constants';
6
+
7
+ let globalContentProvider = null;
8
+
9
+ const defaultContent = {
10
+ searchButtonLabel: 'Search---',
11
+ searchBarLabel: sellDomainNameSearchBarLabel,
12
+ searchBarPlaceholder: sellDomainNameSearchBarPlaceholder,
13
+ searchBarPreText: sellDomainNameSearchBarPreText,
14
+ };
15
+
16
+ const useSellDomainNameSearchContent = (overrides = {}) => {
17
+ const setGlobalContentHandler = (handler) => {
18
+ globalContentProvider = handler;
19
+ };
20
+
21
+ return {
22
+ setGlobalContentHandler,
23
+ getContent: () => {
24
+ return {
25
+ ...defaultContent,
26
+ ...(globalContentProvider ? globalContentProvider() : {}), // provide global content through global injection
27
+ ...overrides, // can override specific contents on demand
28
+ };
29
+ },
30
+ };
31
+ };
32
+
33
+ export default useSellDomainNameSearchContent;
@@ -25,20 +25,19 @@
25
25
  :load-more-domains-button-text="loadMoreDomainsButtonText"
26
26
  :domain-search-location="domainSearchLocation"
27
27
  @load-more-domains="onLoadMoreDomains"
28
- @on-buy-now-click="onBuyNowClick"
29
28
  />
30
29
  <div v-else-if="shouldShowDomainNameNotFound" class="tw-flex tw-justify-center tw-text-center">
31
- Sorry, we couldn't find any domain for "{{ previousSearchText }}".
30
+ {{ domainSearchEmptyMessageWithUserDomainName }}
32
31
  <br />
33
- Try searching with another domain name.
32
+ {{ searchAnotherDomainMessage }}
34
33
  </div>
35
34
  <div v-else></div>
36
35
  </div>
37
36
  </template>
38
37
 
39
38
  <script>
40
- import Loader from '../../../../src/atoms/components/Loader/Loader.vue';
41
- import Picture from '../../../../src/atoms/components/Picture/Picture.vue';
39
+ import Loader from '../../../atoms/components/Loader/Loader.vue';
40
+ import Picture from '../../../atoms/components/Picture/Picture.vue';
42
41
 
43
42
  import SellDomainNameList from '../SellDomainNameList/SellDomainNameList.vue';
44
43
  import Events from '../../constants/event-constants';
@@ -100,13 +99,22 @@ export default {
100
99
  type: String,
101
100
  default: undefined,
102
101
  },
102
+ content: {
103
+ type: Object,
104
+ required: true,
105
+ },
103
106
  },
104
107
  data() {
105
108
  return {
109
+ domainSearchEmptyMessage: this.content.sellDomainNameListSearchResult.domainSearchEmptyMessage,
110
+ searchAnotherDomainMessage: this.content.sellDomainNameListSearchResult.searchAnotherDomainMessage,
106
111
  domainNameItemsInView: undefined,
107
112
  };
108
113
  },
109
114
  computed: {
115
+ domainSearchEmptyMessageWithUserDomainName() {
116
+ return this.domainSearchEmptyMessage.replace('{domainNameSearchTerm}', this.previousSearchText);
117
+ },
110
118
  shouldShowDomainNameNotFound() {
111
119
  return (
112
120
  !this.isBusy &&
@@ -146,9 +154,6 @@ export default {
146
154
  window.dispatchEvent(new CustomEvent(Events.DomainLoadMoreEvent));
147
155
  this.domainNameItemsInView += this.domainNameItemsPerPage;
148
156
  },
149
- onBuyNowClick() {
150
- this.$emit('on-buy-now-click');
151
- },
152
157
  resetDomainNameItemsInView() {
153
158
  this.domainNameItemsInView = this.domainNameItemsPerPage;
154
159
  },
@@ -4,6 +4,7 @@
4
4
  :is-design-com="isDesignCom"
5
5
  :initial-search-term="initialSearchTerm"
6
6
  :show-white-search-background="showWhiteSearchBackground"
7
+ :search-button-label="content.searchButtonLabel"
7
8
  @onSearch="onSearchDomainName"
8
9
  />
9
10
  <SellDomainNameSearchResult
@@ -20,7 +21,7 @@
20
21
  :domain-name-items-per-page="domainNameItemsPerPage"
21
22
  :load-more-domains-button-text="loadMoreDomainsButtonText"
22
23
  :domain-search-location="domainSearchLocation"
23
- @on-buy-now-click="onBuyNowClick"
24
+ :content="content"
24
25
  />
25
26
  </div>
26
27
  </template>
@@ -101,6 +102,10 @@ export default {
101
102
  type: Number,
102
103
  default: undefined,
103
104
  },
105
+ content: {
106
+ type: Object,
107
+ required: true,
108
+ },
104
109
  },
105
110
  data: () => ({
106
111
  domainNameItems: undefined,
@@ -171,9 +176,6 @@ export default {
171
176
  this.isBusy = false;
172
177
  }
173
178
  },
174
- onBuyNowClick() {
175
- this.$emit('on-buy-now-click');
176
- },
177
179
  cleanText(inputText) {
178
180
  // In this function, we use the Unicode property escapes \p{L} and \p{N} to match any Unicode letters (characters from various scripts) and Unicode numbers, respectively.
179
181
  const cleanedText = inputText.replace(/[^\p{L}\p{N}\-.]+/gu, '');