@designcrowd/fe-shared-lib 1.2.0-tr-10 → 1.2.0
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/Dockerfile +0 -2
- package/index.js +0 -2
- package/package.json +2 -7
- package/src/atoms/components/Button/Button.vue +0 -3
- package/src/atoms/components/Button/Buttons.stories.js +0 -24
- package/src/atoms/components/Button/variants/ButtonAi.vue +2 -2
- package/src/atoms/components/Dropdown/Dropdown.stories.js +5 -5
- package/src/atoms/components/Icon/Icon.vue +3 -3
- package/src/experiences/components/PaymentConfigList/PaymentConfig.mixin.js +1 -1
- package/src/experiences/components/PublishBrandPageModal/PublishBrandPageModal.vue +9 -25
- package/src/experiences/components/SellDomainNameList/SellDomainNameList.vue +0 -1
- package/src/experiences/components/SellDomainNameSearchResult/SellDomainNameListSearchResult.vue +0 -4
- package/src/experiences/components/SellDomainNameSearchWithResults/SellDomainNameSearchWithResults.vue +0 -4
- package/nodemon.translation.json +0 -7
- package/src/atoms/components/Button/variants/ButtonOutlinePrimary.vue +0 -53
- package/src/bundleTranslation.js +0 -79
- package/src/bundles/bundled-translations.de-DE.json +0 -5
- package/src/bundles/bundled-translations.es-ES.json +0 -5
- package/src/bundles/bundled-translations.fr-FR.json +0 -5
- package/src/bundles/bundled-translations.json +0 -5
- package/src/bundles/bundled-translations.pt-PT.json +0 -5
- package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.de-DE.json +0 -5
- package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.es-ES.json +0 -5
- package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.fr-FR.json +0 -5
- package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.json +0 -5
- package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.pt-PT.json +0 -5
- package/src/useSharedLibTranslate.js +0 -38
package/Dockerfile
CHANGED
package/index.js
CHANGED
|
@@ -19,8 +19,6 @@ export { default as SellDomainNameWidget } from './src/experiences/components/Se
|
|
|
19
19
|
export { default as PublishBrandPageModal } from './src/experiences/components/PublishBrandPageModal/PublishBrandPageModal.vue';
|
|
20
20
|
export { default as PublishBrandPageCard } from './src/experiences/components/PublishBrandPageModal/PublishBrandPageCard.vue';
|
|
21
21
|
|
|
22
|
-
export { setLocaleAsync, tr } from './src/useSharedLibTranslate';
|
|
23
|
-
|
|
24
22
|
export { default as Button } from './src/atoms/components/Button/Button.vue';
|
|
25
23
|
export { default as ButtonGroup } from './src/atoms/components/ButtonGroup/ButtonGroup.vue';
|
|
26
24
|
export { default as Dropdown } from './src/atoms/components/Dropdown/Dropdown.vue';
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designcrowd/fe-shared-lib",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"start": "run
|
|
5
|
+
"start": "npm run storybook",
|
|
6
6
|
"build": "npm run build:css --production",
|
|
7
7
|
"storybook": "export NODE_ENV=development && npm run storybook:css && npm run storybook:themes && storybook dev -p 6006 public",
|
|
8
8
|
"build:css": "node ./tailwind.build.js",
|
|
9
9
|
"build:storybook": "mkdir -p public && mkdir -p public/css && npm run storybook:css && storybook build -c .storybook -o .storybook-static && cp -R ./public/css .storybook-static/",
|
|
10
|
-
"bundle-translation": "node ./src/bundleTranslation.js",
|
|
11
|
-
"watch:translation": "nodemon --config nodemon.translation.json",
|
|
12
10
|
"storybook:themes": "node ./tailwind.themes.js",
|
|
13
11
|
"storybook:css": "node ./tailwind.build.js --storybook",
|
|
14
12
|
"lint": "NODE_ENV=production eslint ./src/ --ext .ts,.js,.vue",
|
|
@@ -28,7 +26,6 @@
|
|
|
28
26
|
"cropperjs": "1.6.1",
|
|
29
27
|
"dropzone-vue3": "1.0.2",
|
|
30
28
|
"fs-extra": "11.2.0",
|
|
31
|
-
"i18next": "25.2.1",
|
|
32
29
|
"lodash.throttle": "4.1.1",
|
|
33
30
|
"postcss-loader": "8.1.0",
|
|
34
31
|
"swiper": "11.0.6",
|
|
@@ -65,8 +62,6 @@
|
|
|
65
62
|
"eslint-plugin-vue": "9.21.1",
|
|
66
63
|
"husky": "9.0.10",
|
|
67
64
|
"lint-staged": "15.2.1",
|
|
68
|
-
"nodemon": "3.0.3",
|
|
69
|
-
"npm-run-all": "4.1.5",
|
|
70
65
|
"postcss": "8.4.33",
|
|
71
66
|
"postcss-cli": "11.0.0",
|
|
72
67
|
"postcss-import": "16.0.0",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
<script>
|
|
85
85
|
import ButtonOutline from './variants/ButtonOutline.vue';
|
|
86
86
|
import ButtonPrimary from './variants/ButtonPrimary.vue';
|
|
87
|
-
import ButtonOutlinePrimary from './variants/ButtonOutlinePrimary.vue';
|
|
88
87
|
import ButtonWarning from './variants/ButtonWarning.vue';
|
|
89
88
|
import ButtonSecondary from './variants/ButtonSecondary.vue';
|
|
90
89
|
import ButtonInfoFilled from './variants/ButtonInfoFilled.vue';
|
|
@@ -108,7 +107,6 @@ export default {
|
|
|
108
107
|
name: 'Button',
|
|
109
108
|
components: {
|
|
110
109
|
'button-crazyDomains-primary': ButtonCrazyDomainsPrimary,
|
|
111
|
-
'button-crazyDomains-outline-primary': ButtonOutlinePrimary,
|
|
112
110
|
'button-crazyDomains-outline': ButtonCrazyDomainsOutline,
|
|
113
111
|
'button-crazyDomains-secondary': ButtonSecondary,
|
|
114
112
|
'button-crazyDomains-primary-with-icon': ButtonPrimaryWithIcon,
|
|
@@ -120,7 +118,6 @@ export default {
|
|
|
120
118
|
'button-crazyDomains-pill': ButtonPill,
|
|
121
119
|
|
|
122
120
|
'button-brandCrowd-primary': ButtonPrimary,
|
|
123
|
-
'button-brandCrowd-outline-primary': ButtonOutlinePrimary,
|
|
124
121
|
'button-brandCrowd-warning': ButtonWarning,
|
|
125
122
|
'button-brandCrowd-info-filled': ButtonInfoFilled,
|
|
126
123
|
'button-brandCrowd-outline': ButtonOutline,
|
|
@@ -278,30 +278,6 @@ export const PrimarySamples = (args, { argTypes }) => {
|
|
|
278
278
|
PrimarySamples.args = controlArgs;
|
|
279
279
|
PrimarySamples.argTypes = controlArgTypes;
|
|
280
280
|
|
|
281
|
-
export const OutlinePrimarySamples = (args, { argTypes }) => {
|
|
282
|
-
return {
|
|
283
|
-
components: {
|
|
284
|
-
StorybookButtonComponent,
|
|
285
|
-
},
|
|
286
|
-
props: Object.keys(argTypes),
|
|
287
|
-
data() {
|
|
288
|
-
return {
|
|
289
|
-
variants: generateSampleButtonVariants('outline-primary'),
|
|
290
|
-
};
|
|
291
|
-
},
|
|
292
|
-
template: `
|
|
293
|
-
<StorybookButtonComponent
|
|
294
|
-
:disabled="disabled"
|
|
295
|
-
:full-width="fullWidth"
|
|
296
|
-
:grey-out-left="greyOutLeft"
|
|
297
|
-
:justify="justify"
|
|
298
|
-
:variants="variants"/>
|
|
299
|
-
`,
|
|
300
|
-
};
|
|
301
|
-
};
|
|
302
|
-
OutlinePrimarySamples.args = controlArgs;
|
|
303
|
-
OutlinePrimarySamples.argTypes = controlArgTypes;
|
|
304
|
-
|
|
305
281
|
export const SecondarySamples = (args, { argTypes }) => {
|
|
306
282
|
return {
|
|
307
283
|
components: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<button
|
|
3
3
|
v-if="!url"
|
|
4
4
|
style="box-shadow: rgba(151, 65, 252, 0.2) 0 15px 30px -5px;"
|
|
5
|
-
class="tw-font-sans tw-bg-gradient-to-t tw-from-[#d946ef] tw-to-[#8b5cf6] tw-border-0 tw-font-bold tw-p-1 tw-text-white tw-duration-300 hover:tw-brightness-[0.85]"
|
|
5
|
+
class="tw-font-sans tw-bg-gradient-to-t tw-from-[#d946ef] tw-to-[#8b5cf6] tw-border-0 tw-font-bold tw-rounded-xl tw-p-1 tw-text-white tw-duration-300 hover:tw-brightness-[0.85]"
|
|
6
6
|
:class="[
|
|
7
7
|
classes,
|
|
8
8
|
{
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<a
|
|
26
26
|
v-else
|
|
27
27
|
:href="computedUrl"
|
|
28
|
-
class="tw-font-sans tw-inline-flex tw-justify-center tw-bg-gradient-to-t tw-from-[#d946ef] tw-to-[#8b5cf6] tw-border-0 tw-font-bold tw-text-white"
|
|
28
|
+
class="tw-font-sans tw-inline-flex tw-justify-center tw-rounded-xl tw-bg-gradient-to-t tw-from-[#d946ef] tw-to-[#8b5cf6] tw-border-0 tw-font-bold tw-text-white"
|
|
29
29
|
:class="[
|
|
30
30
|
commonUrlButtonClasses,
|
|
31
31
|
classes,
|
|
@@ -18,11 +18,11 @@ export const Sample = () => {
|
|
|
18
18
|
data() {
|
|
19
19
|
return {
|
|
20
20
|
show: true,
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
},
|
|
23
23
|
template: `
|
|
24
24
|
<div class="tw-font-sans tw-w-1/4">
|
|
25
|
-
<Dropdown menu-align="right" v-model:show="show" @update:show="(visible) => show = visible"
|
|
25
|
+
<Dropdown menu-align="right" v-model:show="show" @update:show="(visible) => show = visible">
|
|
26
26
|
<DropdownItem @click="() => show = false">
|
|
27
27
|
<span class="tw-grow">Menu item 1</span>
|
|
28
28
|
<Pill class="tw-text-white" :style="{ background: 'blue' }">Blue</Pill>
|
|
@@ -45,7 +45,7 @@ export const Disabled = () => {
|
|
|
45
45
|
},
|
|
46
46
|
template: `
|
|
47
47
|
<div class="tw-font-sans tw-w-1/4">
|
|
48
|
-
<Dropdown menu-align="right" disabled
|
|
48
|
+
<Dropdown menu-align="right" disabled>
|
|
49
49
|
<DropdownItem>
|
|
50
50
|
<span>Menu item 1</span>
|
|
51
51
|
</DropdownItem>
|
|
@@ -67,7 +67,7 @@ export const LongListFixedHeight = () => {
|
|
|
67
67
|
},
|
|
68
68
|
template: `
|
|
69
69
|
<div class="tw-font-sans tw-w-1/4">
|
|
70
|
-
<Dropdown menu-align="right" menu-element-classes="tw-h-40 tw-overflow-y-auto
|
|
70
|
+
<Dropdown menu-align="right" menu-element-classes="tw-h-40 tw-overflow-y-auto">
|
|
71
71
|
<DropdownItem v-for="(item, i) in items" :key="i">
|
|
72
72
|
<span class="tw-grow">{{ item.display }}</span>
|
|
73
73
|
</DropdownItem>
|
|
@@ -123,7 +123,7 @@ export const SampleElementClasses = () => {
|
|
|
123
123
|
},
|
|
124
124
|
template: `
|
|
125
125
|
<div class="tw-flex tw-gap-2 tw-m-4">
|
|
126
|
-
<Dropdown menu-align="right" element-classes="tw-h-12"
|
|
126
|
+
<Dropdown menu-align="right" element-classes="tw-h-12">
|
|
127
127
|
<DropdownItem>
|
|
128
128
|
<span class="tw-grow">Menu item 1</span>
|
|
129
129
|
<Pill class="tw-text-white" :style="{ background: 'blue' }">Blue</Pill>
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
aria-labelledby="title"
|
|
21
21
|
aria-describedby="desc"
|
|
22
22
|
>
|
|
23
|
-
<title
|
|
24
|
-
<desc
|
|
23
|
+
<title :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
|
|
24
|
+
<desc :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
|
|
25
25
|
<component :is="`icon-${iconName}`"></component>
|
|
26
26
|
</svg>
|
|
27
27
|
</div>
|
|
@@ -799,7 +799,7 @@ export default {
|
|
|
799
799
|
return css || null;
|
|
800
800
|
},
|
|
801
801
|
title() {
|
|
802
|
-
return this.altText
|
|
802
|
+
return this.altText || `${this.titleCase(this.name)}`;
|
|
803
803
|
},
|
|
804
804
|
description() {
|
|
805
805
|
return `${this.title} Icon`;
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<div v-if="isNotPublished || isSlugEditMode" class="tw-mt-4">
|
|
51
51
|
<PublishBrandPageCard
|
|
52
52
|
v-if="!hasPurchasedDomains"
|
|
53
|
-
:
|
|
53
|
+
:imgUrl="iconUrl"
|
|
54
54
|
title="Free Address"
|
|
55
55
|
description="Choose a free address to publish now. You can always edit the URL later"
|
|
56
56
|
:is-design-com="isDesignCom"
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
data-test-brand-page-publish-button
|
|
85
85
|
variant="primary"
|
|
86
86
|
size="small-medium"
|
|
87
|
+
@on-click="onPublish"
|
|
87
88
|
:full-width="isMobile"
|
|
88
89
|
:class="{
|
|
89
90
|
'tw-uppercase': !isDesignCom,
|
|
90
91
|
}"
|
|
91
|
-
@on-click="onPublish"
|
|
92
92
|
/>
|
|
93
93
|
</div>
|
|
94
94
|
</template>
|
|
@@ -138,7 +138,6 @@
|
|
|
138
138
|
:element-classes="{
|
|
139
139
|
'tw-h-12': true,
|
|
140
140
|
}"
|
|
141
|
-
menu-element-classes="tw-w-full"
|
|
142
141
|
:disabled="domainTypeValue === DOMAIN_TYPES.slug"
|
|
143
142
|
:class="{
|
|
144
143
|
'tw-text-grayscale-600 tw-font-normal': !selectedCustomDomain,
|
|
@@ -196,7 +195,6 @@
|
|
|
196
195
|
:display-result-limit="4"
|
|
197
196
|
:domain-search-location="sitePublishedModal"
|
|
198
197
|
@on-change-search="onSearchTextChanged"
|
|
199
|
-
@on-buy-now-click="onBuyNowClick"
|
|
200
198
|
/>
|
|
201
199
|
</div>
|
|
202
200
|
<Button
|
|
@@ -246,21 +244,19 @@
|
|
|
246
244
|
</div>
|
|
247
245
|
</template>
|
|
248
246
|
<script>
|
|
249
|
-
import
|
|
250
|
-
import Modal from '../../../atoms/components/Modal/Modal.vue';
|
|
247
|
+
import Modal from '../../../../src/atoms/components/Modal/Modal.vue';
|
|
251
248
|
import PublishBrandPageCard from './PublishBrandPageCard.vue';
|
|
252
|
-
import TextInput from '
|
|
253
|
-
import Dropdown from '
|
|
254
|
-
import DropdownItem from '
|
|
255
|
-
import Button from '
|
|
256
|
-
import TextCopyField from '
|
|
249
|
+
import TextInput from '../../../../src/atoms/components/TextInput/TextInput.vue';
|
|
250
|
+
import Dropdown from '../../../../src/atoms/components/Dropdown/Dropdown.vue';
|
|
251
|
+
import DropdownItem from '../../../../src/atoms/components/Dropdown/DropdownItem.vue';
|
|
252
|
+
import Button from '../../../../src/atoms/components/Button/Button.vue';
|
|
253
|
+
import TextCopyField from '../../../../src/atoms/components/TextCopyField/TextCopyField.vue';
|
|
257
254
|
|
|
258
255
|
import SellDomainNameSearchWithResults from '../SellDomainNameSearchWithResults/SellDomainNameSearchWithResults.vue';
|
|
259
256
|
import SellDomainNameListModal from '../SellDomainNameListModal/SellDomainNameListModal.vue';
|
|
260
257
|
import brandCrowdApiClient from '../../clients/brand-crowd-api.client';
|
|
261
258
|
import Events, { sitePublishedModal } from '../../constants/event-constants';
|
|
262
259
|
import mediaQueryMixin from '../../mixins/mediaQueryMixin';
|
|
263
|
-
import { tr } from '../../../useSharedLibTranslate';
|
|
264
260
|
|
|
265
261
|
const headerSubtitle = 'Buy matching domain name for your brand';
|
|
266
262
|
|
|
@@ -415,12 +411,6 @@ export default {
|
|
|
415
411
|
'on-view-more-domains',
|
|
416
412
|
'on-slug-changed',
|
|
417
413
|
],
|
|
418
|
-
setup() {
|
|
419
|
-
return {
|
|
420
|
-
tr,
|
|
421
|
-
testMessage: computed(() => tr('publishModal.test')),
|
|
422
|
-
};
|
|
423
|
-
},
|
|
424
414
|
data() {
|
|
425
415
|
return {
|
|
426
416
|
DOMAIN_TYPES,
|
|
@@ -494,13 +484,11 @@ export default {
|
|
|
494
484
|
this.$emit('radio-button-changed', domain);
|
|
495
485
|
},
|
|
496
486
|
onCloseModal() {
|
|
497
|
-
console.log('closing the modal with', this.tr('publishModal.test'));
|
|
498
|
-
|
|
499
487
|
this.$emit('close-modal');
|
|
500
488
|
this.$emit('on-hide-domain-modal');
|
|
501
489
|
},
|
|
502
490
|
onCopyUrlClick() {
|
|
503
|
-
this.$emit('copy-url-
|
|
491
|
+
this.$emit('copy-url-click');
|
|
504
492
|
},
|
|
505
493
|
onSlugChanged(e) {
|
|
506
494
|
this.searchText = e;
|
|
@@ -520,7 +508,6 @@ export default {
|
|
|
520
508
|
},
|
|
521
509
|
onSearchTextChanged(val) {
|
|
522
510
|
this.searchText = val;
|
|
523
|
-
this.$emit('on-change-search', val);
|
|
524
511
|
},
|
|
525
512
|
onSelectPurchasedDomain(newVal) {
|
|
526
513
|
this.selectedCustomDomain = newVal;
|
|
@@ -536,9 +523,6 @@ export default {
|
|
|
536
523
|
onSellDomainNameListCloseModal() {
|
|
537
524
|
this.$emit('on-hide-domain-modal');
|
|
538
525
|
},
|
|
539
|
-
onBuyNowClick() {
|
|
540
|
-
this.$emit('on-buy-now-clicked');
|
|
541
|
-
},
|
|
542
526
|
async searchDomainName(isUserTriggered) {
|
|
543
527
|
this.isLoading = true;
|
|
544
528
|
let searchSlug = '';
|
|
@@ -114,7 +114,6 @@ export default {
|
|
|
114
114
|
if (typeof this.domainSearchLocation !== 'undefined') {
|
|
115
115
|
request.domainSearchLocation = this.domainSearchLocation;
|
|
116
116
|
}
|
|
117
|
-
this.$emit('on-buy-now-click');
|
|
118
117
|
window.dispatchEvent(
|
|
119
118
|
new CustomEvent(Events.DomainSelectedEvent, {
|
|
120
119
|
detail: request,
|
package/src/experiences/components/SellDomainNameSearchResult/SellDomainNameListSearchResult.vue
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
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
30
|
Sorry, we couldn't find any domain for "{{ previousSearchText }}".
|
|
@@ -146,9 +145,6 @@ export default {
|
|
|
146
145
|
window.dispatchEvent(new CustomEvent(Events.DomainLoadMoreEvent));
|
|
147
146
|
this.domainNameItemsInView += this.domainNameItemsPerPage;
|
|
148
147
|
},
|
|
149
|
-
onBuyNowClick() {
|
|
150
|
-
this.$emit('on-buy-now-click');
|
|
151
|
-
},
|
|
152
148
|
resetDomainNameItemsInView() {
|
|
153
149
|
this.domainNameItemsInView = this.domainNameItemsPerPage;
|
|
154
150
|
},
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
:domain-name-items-per-page="domainNameItemsPerPage"
|
|
21
21
|
:load-more-domains-button-text="loadMoreDomainsButtonText"
|
|
22
22
|
:domain-search-location="domainSearchLocation"
|
|
23
|
-
@on-buy-now-click="onBuyNowClick"
|
|
24
23
|
/>
|
|
25
24
|
</div>
|
|
26
25
|
</template>
|
|
@@ -171,9 +170,6 @@ export default {
|
|
|
171
170
|
this.isBusy = false;
|
|
172
171
|
}
|
|
173
172
|
},
|
|
174
|
-
onBuyNowClick() {
|
|
175
|
-
this.$emit('on-buy-now-click');
|
|
176
|
-
},
|
|
177
173
|
cleanText(inputText) {
|
|
178
174
|
// 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
175
|
const cleanedText = inputText.replace(/[^\p{L}\p{N}\-.]+/gu, '');
|
package/nodemon.translation.json
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button
|
|
3
|
-
v-if="!url"
|
|
4
|
-
class="tw-font-sans tw-border-2 tw-border-solid tw-font-bold tw-text-primary-500 tw-uppercase tw-transition-colors tw-duration-300"
|
|
5
|
-
:class="[
|
|
6
|
-
classes,
|
|
7
|
-
computedClasses,
|
|
8
|
-
{
|
|
9
|
-
'tw-border-grayscale-500 tw-bg-grayscale-400 tw-text-grayscale-600 tw-cursor-not-allowed': disabled,
|
|
10
|
-
'tw-cursor-pointer': !disabled,
|
|
11
|
-
'tw-border-primary-500 tw-bg-white hover:tw-bg-primary-100 tw-text-primary-500': !isBusy && !disabled,
|
|
12
|
-
'tw-border-grayscale-500 tw-bg-grayscale-400 hover:tw-bg-grayscale-300 hover:tw-border-grayscale-400 tw-text-grayscale-600':
|
|
13
|
-
isBusy,
|
|
14
|
-
},
|
|
15
|
-
]"
|
|
16
|
-
:disabled="disabled"
|
|
17
|
-
:type="type"
|
|
18
|
-
v-bind="attrs"
|
|
19
|
-
@click="onClick"
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</button>
|
|
23
|
-
<a
|
|
24
|
-
v-else
|
|
25
|
-
:href="computedUrl"
|
|
26
|
-
class="tw-justify-center tw-font-sans tw-inline-flex tw-border-2 tw-border-solid tw-font-bold tw-uppercase tw-transition-colors tw-duration-300"
|
|
27
|
-
:class="[
|
|
28
|
-
commonUrlButtonClasses,
|
|
29
|
-
classes,
|
|
30
|
-
computedClasses,
|
|
31
|
-
{
|
|
32
|
-
'tw-cursor-wait': disabled,
|
|
33
|
-
'tw-cursor-pointer': !disabled,
|
|
34
|
-
'tw-border-primary-500 tw-bg-white hover:tw-bg-primary-100 tw-text-primary-500': !isBusy,
|
|
35
|
-
'tw-border-grayscale-500 tw-bg-grayscale-400 hover:tw-bg-grayscale-300 hover:tw-border-grayscale-400 tw-text-grayscale-600':
|
|
36
|
-
isBusy,
|
|
37
|
-
},
|
|
38
|
-
]"
|
|
39
|
-
:download="download"
|
|
40
|
-
v-bind="attrs"
|
|
41
|
-
:target="target"
|
|
42
|
-
@click="onClick"
|
|
43
|
-
>
|
|
44
|
-
<slot />
|
|
45
|
-
</a>
|
|
46
|
-
</template>
|
|
47
|
-
<script>
|
|
48
|
-
import ButtonVariant from '../ButtonVariant.mixin.vue';
|
|
49
|
-
|
|
50
|
-
export default {
|
|
51
|
-
mixins: [ButtonVariant],
|
|
52
|
-
};
|
|
53
|
-
</script>
|
package/src/bundleTranslation.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
|
|
4
|
-
const localeSuffixes = ['.de-DE', '.fr-FR', '.es-ES', '.pt-PT', ''];
|
|
5
|
-
|
|
6
|
-
const findTranslationFiles = (dir, localeString) => {
|
|
7
|
-
const files = [];
|
|
8
|
-
const entries = fs.readdirSync(dir);
|
|
9
|
-
|
|
10
|
-
entries.forEach((entry) => {
|
|
11
|
-
const fullPath = path.join(dir, entry);
|
|
12
|
-
|
|
13
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
14
|
-
if (entry === 'i18n') {
|
|
15
|
-
files.push(
|
|
16
|
-
...fs
|
|
17
|
-
.readdirSync(fullPath)
|
|
18
|
-
.filter((file) => file.endsWith(`${localeString}.json`))
|
|
19
|
-
.map((file) => path.join(fullPath, file)),
|
|
20
|
-
);
|
|
21
|
-
} else {
|
|
22
|
-
// Recursively find translation files in nested folders
|
|
23
|
-
files.push(...findTranslationFiles(fullPath, localeString));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return files;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const bundle = () => {
|
|
32
|
-
console.log('Bundling translations...', __dirname);
|
|
33
|
-
|
|
34
|
-
const bundlesDir = path.resolve(__dirname, './bundles');
|
|
35
|
-
|
|
36
|
-
console.log('bundlesDir', bundlesDir);
|
|
37
|
-
|
|
38
|
-
if (!fs.existsSync(bundlesDir)) {
|
|
39
|
-
console.log('Creating bundles dir');
|
|
40
|
-
fs.mkdirSync(bundlesDir);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const rootDir = path.resolve(__dirname, '../src');
|
|
44
|
-
|
|
45
|
-
localeSuffixes.forEach((locale) => {
|
|
46
|
-
const outputFile = path.resolve(bundlesDir, `bundled-translations${locale}.json`);
|
|
47
|
-
|
|
48
|
-
const translationFiles = findTranslationFiles(rootDir, locale);
|
|
49
|
-
|
|
50
|
-
console.log(
|
|
51
|
-
`Found ${translationFiles.length} translation files in BrandPage for file prefix: ${`bundled-translations${locale}.json`}`,
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const translations = {};
|
|
55
|
-
|
|
56
|
-
translationFiles.forEach((file) => {
|
|
57
|
-
const fileContent = fs.readFileSync(file, 'utf-8');
|
|
58
|
-
|
|
59
|
-
Object.assign(translations, JSON.parse(fileContent));
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
console.log(`Writing bundled translations to: ${outputFile}`);
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
const potentiallyExistingFile = fs.readFileSync(outputFile, 'utf-8');
|
|
66
|
-
|
|
67
|
-
if (potentiallyExistingFile === JSON.stringify(translations, null, 2)) {
|
|
68
|
-
console.log('Current translations are the same as the existing file - skipping write');
|
|
69
|
-
} else {
|
|
70
|
-
fs.writeFileSync(outputFile, JSON.stringify(translations, null, 2));
|
|
71
|
-
}
|
|
72
|
-
} catch (e) {
|
|
73
|
-
console.log("Translation file doesn't exist, creating new one");
|
|
74
|
-
fs.writeFileSync(outputFile, JSON.stringify(translations, null, 2));
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
bundle();
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
import i18next from 'i18next';
|
|
3
|
-
|
|
4
|
-
const fallbackLocale = 'en-US';
|
|
5
|
-
|
|
6
|
-
const relativePathsToTranslationFiles = {
|
|
7
|
-
'en-US': () => import('./bundles/bundled-translations.json'),
|
|
8
|
-
'de-DE': () => import('./bundles/bundled-translations.de-DE.json'),
|
|
9
|
-
'fr-FR': () => import('./bundles/bundled-translations.fr-FR.json'),
|
|
10
|
-
'es-ES': () => import('./bundles/bundled-translations.es-ES.json'),
|
|
11
|
-
'pt-PT': () => import('./bundles/bundled-translations.pt-PT.json'),
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const setLocaleAsync = async (locale = 'en-US') => {
|
|
15
|
-
const localeToUse = locale;
|
|
16
|
-
|
|
17
|
-
if (!i18next.isInitialized) {
|
|
18
|
-
await i18next.init({
|
|
19
|
-
debug: false,
|
|
20
|
-
fallbackLng: fallbackLocale,
|
|
21
|
-
lng: localeToUse,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const languageFile = (await relativePathsToTranslationFiles[localeToUse]()).default;
|
|
26
|
-
|
|
27
|
-
await i18next.addResourceBundle(localeToUse, 'fe-shared-lib', {
|
|
28
|
-
...languageFile,
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const tr = (key, valuesToInterpolate = {}) => {
|
|
33
|
-
const translated = i18next.t(key, { ns: 'fe-shared-lib', ...valuesToInterpolate });
|
|
34
|
-
|
|
35
|
-
return translated;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { setLocaleAsync, tr };
|