chore: Add i18n and components into storybook (#2188)

* chore: Add i18n and store into storybook

* Use empty store to init storybook
This commit is contained in:
Nithin David Thomas 2021-04-30 15:24:00 +05:30 committed by GitHub
parent b6f57d7fc1
commit bd7e9d2790
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View file

@ -1,5 +1,32 @@
import { addDecorator } from '@storybook/vue';
import Vue from 'vue';
import Vuex from 'vuex';
import VueI18n from 'vue-i18n';
import WootUiKit from '../app/javascript/dashboard/components';
import i18n from '../app/javascript/dashboard/i18n';
import '../app/javascript/dashboard/assets/scss/storybook.scss';
Vue.use(VueI18n);
Vue.use(WootUiKit);
Vue.use(Vuex);
const store = new Vuex.Store({});
const i18nConfig = new VueI18n({
locale: 'en',
messages: i18n,
});
addDecorator(() => ({
template: '<story/>',
i18n: i18nConfig,
store,
beforeCreate: function() {
this.$root._i18n = this.$i18n;
},
}));
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {

View file

@ -10,7 +10,7 @@ const {
PRIVACY_URL: privacyURL,
TERMS_URL: termsURL,
WIDGET_BRAND_URL: widgetBrandURL,
} = window.globalConfig;
} = window.globalConfig || {};
const state = {
appVersion,