Skip to content

Commit

Permalink
feat: 🎸 update
Browse files Browse the repository at this point in the history
  • Loading branch information
divisey committed Jul 10, 2022
1 parent 6537a04 commit f6597b6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
14 changes: 13 additions & 1 deletion packages/theme-docs/components/PageContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@
import { Component, Vue } from "vue-property-decorator";
import PageEdit from "@theme/components/PageEdit.vue";
import PageNav from "@theme/components/PageNav.vue";
import { getLocale } from "@foxone/utils/helper";
@Component({
inheritAttrs: false,
components: {
PageEdit,
PageNav
},
beforeRouteEnter(_to, _from, next) {
next((vm: any) => {
vm.setLang();
});
}
})
class PageContent extends Vue {}
class PageContent extends Vue {
setLang() {
const locale = getLocale();
this.$vuetify.lang.current = locale;
}
}
export default PageContent;
</script>

Expand Down
28 changes: 19 additions & 9 deletions packages/theme-docs/enhanceApp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vuex from "vuex";
import Vuetify from "vuetify/lib";
import UIKit from "@foxone/uikit";
import * as icons from "@foxone/icons";
import { mergeDeep } from "vuetify/lib/util/helpers";
import locales from "./locales.json";
Expand All @@ -12,12 +11,13 @@ import "@theme/styles/index.scss";

export default ({
Vue,
isServer,
options, // options for root Vue instance: new Vue(options)
// router,
siteData
}) => {
const vuetifyOptions = siteData.themeConfig.vuetifyOptions || {};
const preset = mergeDeep(UIKit.preset, {
let customConfig = {
icons: {
values: {
...Object.keys(icons).reduce((m, k) => {
Expand All @@ -42,19 +42,29 @@ export default ({
}
}
}
});
const vuetify = new Vuetify(mergeDeep(preset, vuetifyOptions));
};

options.vuetify = vuetify;
if (!isServer) {
if (!options.vuetify) {
const vuetify = new Vuetify(mergeDeep(customConfig, vuetifyOptions));

Vue.use(Vuetify);
options.vuetify = vuetify;
}

const UIKit = require("@foxone/uikit");

customConfig = mergeDeep(UIKit.preset, customConfig);

if (typeof window !== undefined) {
Vue.use(UIKit);
Vue.use(UIKit.Toast, vuetify, { top: false, centered: true });
Vue.use(UIKit.Dialog, vuetify, { flat: true });
Vue.use(UIKit.Toast, () => options.vuetify, { top: false, centered: true });
Vue.use(UIKit.Dialog, () => options.vuetify, { flat: true });
} else {
const vuetify = new Vuetify(mergeDeep(customConfig, vuetifyOptions));

options.vuetify = vuetify;
}

Vue.use(Vuetify);
Vue.use(Vuex);
Vue.mixin({ store });

Expand Down

0 comments on commit f6597b6

Please sign in to comment.