|
1 | 1 | <template>
|
2 | 2 | <v-app id="home">
|
3 | 3 | <!-- ====================================================== App Bar -->
|
4 |
| - <AppBar @updated-drawer="toggleDrawer" /> |
| 4 | + <AppBar |
| 5 | + @changed-theme="updateCodeBlockTheme" |
| 6 | + @updated-drawer="toggleDrawer" |
| 7 | + /> |
5 | 8 |
|
6 | 9 | <!-- ====================================================== Navigation Drawer -->
|
7 | 10 | <v-navigation-drawer
|
|
14 | 17 | </v-navigation-drawer>
|
15 | 18 |
|
16 | 19 | <!-- ====================================================== Main Container -->
|
17 |
| - <v-main class="main-container pb-10"> |
18 |
| - <v-responsive> |
19 |
| - <v-container class="px-10"> |
20 |
| - <DocsPage /> |
21 |
| - </v-container> |
22 |
| - </v-responsive> |
| 20 | + <v-main class="pb-10"> |
| 21 | + <v-container class="px-7"> |
| 22 | + <DocsPage :codeBlockOptions="codeBlockSettings" /> |
| 23 | + </v-container> |
23 | 24 | </v-main>
|
24 | 25 | </v-app>
|
25 | 26 | </template>
|
26 | 27 |
|
27 | 28 | <script setup>
|
28 | 29 | import { provide, ref } from 'vue';
|
| 30 | +import { useDisplay } from 'vuetify'; |
29 | 31 | import AppBar from './documentation/layout/AppBar.vue';
|
30 | 32 | import MenuComponent from './documentation/components/MenuComponent.vue';
|
31 | 33 | import DocsPage from './documentation/DocsPage.vue';
|
32 | 34 | import { useCoreStore } from './stores/index';
|
| 35 | +// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars |
| 36 | +import Prism from 'prismjs'; |
| 37 | +import 'prismjs/components/prism-typescript.js'; |
33 | 38 |
|
34 |
| -const store = useCoreStore(); |
35 | 39 |
|
36 |
| -const drawer = ref(true); |
| 40 | +const { smAndUp } = useDisplay(); |
| 41 | +
|
| 42 | +const isSmAndUp = computed(() => smAndUp.value); |
| 43 | +const store = useCoreStore(); |
| 44 | +const drawer = ref(isSmAndUp.value); |
37 | 45 | const drawerOptions = ref({
|
38 | 46 | absolute: false,
|
39 | 47 | color: '',
|
40 | 48 | elevation: 10,
|
41 | 49 | });
|
42 |
| -const links = store.links; |
43 |
| -
|
44 |
| -const menuItems = reactive([ |
45 |
| - { |
46 |
| - href: '#home', |
47 |
| - icon: 'mdi:mdi-home', |
48 |
| - title: 'Home', |
49 |
| - }, |
50 |
| - { |
51 |
| - href: '#installation', |
52 |
| - icon: 'mdi:mdi-plus-thick', |
53 |
| - title: 'Installation', |
54 |
| - }, |
55 |
| - { |
56 |
| - href: '#description', |
57 |
| - icon: 'mdi:mdi-information-outline', |
58 |
| - title: 'Description', |
59 |
| - }, |
60 |
| - { |
61 |
| - href: '#props', |
62 |
| - icon: 'mdi:mdi-cog', |
63 |
| - items: [ |
64 |
| - { |
65 |
| - href: '#props', |
66 |
| - icon: 'mdi:mdi-checkbox-outline', |
67 |
| - key: 'shared-props', |
68 |
| - title: 'Props', |
69 |
| - }, |
70 |
| - { |
71 |
| - href: '#props-shared', |
72 |
| - icon: 'mdi:mdi-checkbox-outline', |
73 |
| - key: 'shared-props', |
74 |
| - title: 'Shared Props', |
75 |
| - }, |
76 |
| - ], |
77 |
| - title: 'Props', |
78 |
| - }, |
79 |
| - { |
80 |
| - href: '#components', |
81 |
| - icon: 'mdi:mdi-cog', |
82 |
| - items: [ |
83 |
| - { |
84 |
| - icon: 'mdi:mdi-github', |
85 |
| - key: 'vuetify-github', |
86 |
| - link: links.vuetifyGithub, |
87 |
| - title: 'Github', |
88 |
| - }, |
89 |
| - { |
90 |
| - key: 'vuetify', |
91 |
| - link: `${links.vuetify}en/components/all/`, |
92 |
| - title: 'Components', |
93 |
| - }, |
94 |
| - { |
95 |
| - href: '#components-props', |
96 |
| - icon: 'mdi:mdi-checkbox-outline', |
97 |
| - key: 'shared-props', |
98 |
| - title: 'Props', |
99 |
| - }, |
100 |
| - { |
101 |
| - href: '#components-shared-props', |
102 |
| - icon: 'mdi:mdi-checkbox-outline', |
103 |
| - key: 'shared-props', |
104 |
| - title: 'Shared Props', |
105 |
| - }, |
106 |
| - { |
107 |
| - href: '#components-v-inline-checkbox', |
108 |
| - icon: 'mdi:mdi-checkbox-outline', |
109 |
| - key: 'v-checkbox', |
110 |
| - link: `${links.vuetify}en/api/v-checkbox/`, |
111 |
| - title: 'VCheckbox', |
112 |
| - }, |
113 |
| - { |
114 |
| - href: '#components-v-inline-select', |
115 |
| - icon: 'mdi:mdi-format-list-bulleted', |
116 |
| - key: 'v-select', |
117 |
| - link: `${links.vuetify}en/api/v-select/`, |
118 |
| - title: 'VSelect', |
119 |
| - }, |
120 |
| - { |
121 |
| - href: '#components-v-inline-switch', |
122 |
| - icon: 'mdi:mdi-toggle-switch-off-outline', |
123 |
| - key: 'v-switch', |
124 |
| - link: `${links.vuetify}en/api/v-switch/`, |
125 |
| - title: 'VSwitch', |
126 |
| - }, |
127 |
| - { |
128 |
| - href: '#components-v-inline-textarea', |
129 |
| - icon: 'mdi:mdi-text-long', |
130 |
| - key: 'v-textarea', |
131 |
| - link: `${links.vuetify}en/api/v-textarea/`, |
132 |
| - title: 'VTextarea', |
133 |
| - }, |
134 |
| - { |
135 |
| - href: '#components-v-inline-textfield', |
136 |
| - icon: 'mdi:mdi-minus', |
137 |
| - key: 'v-text-field', |
138 |
| - link: `${links.vuetify}en/api/v-text-field/`, |
139 |
| - title: 'VTextField', |
140 |
| - }, |
141 |
| - ], |
142 |
| - key: 'components', |
143 |
| - title: 'Components', |
144 |
| - }, |
145 |
| - { |
146 |
| - href: '#events', |
147 |
| - icon: 'mdi:mdi-calendar-star', |
148 |
| - title: 'Events', |
149 |
| - }, |
150 |
| - { |
151 |
| - href: '#slots', |
152 |
| - icon: 'mdi:mdi-slot-machine', |
153 |
| - title: 'Slots', |
154 |
| - }, |
155 |
| - { |
156 |
| - href: '#sass-variables', |
157 |
| - icon: 'mdi:mdi-sass', |
158 |
| - title: 'SASS Variables', |
159 |
| - }, |
160 |
| - { |
161 |
| - href: '#example', |
162 |
| - icon: 'mdi:mdi-code-json', |
163 |
| - title: 'Example', |
164 |
| - }, |
165 |
| - { |
166 |
| - href: '#dependencies', |
167 |
| - icon: 'mdi:mdi-asterisk-circle-outline', |
168 |
| - title: 'Dependencies', |
169 |
| - }, |
170 |
| - { |
171 |
| - href: '#license', |
172 |
| - icon: 'mdi:mdi-card-account-details-outline', |
173 |
| - title: 'License', |
174 |
| - }, |
175 |
| - { |
176 |
| - href: '#legal', |
177 |
| - icon: 'mdi:mdi-scale-balance', |
178 |
| - title: 'Legal', |
179 |
| - }, |
180 |
| -]); |
| 50 | +
|
| 51 | +
|
| 52 | +const codeBlockPlugin = 'prismjs'; |
| 53 | +const codeBlockLightTheme = 'tomorrow'; |
| 54 | +const codeBlockDarkTheme = 'tomorrow'; |
| 55 | +
|
| 56 | +const codeBlockSettings = ref({ |
| 57 | + plugin: codeBlockPlugin, |
| 58 | + theme: codeBlockDarkTheme, |
| 59 | +}); |
| 60 | +
|
| 61 | +function updateCodeBlockTheme(val) { |
| 62 | + codeBlockSettings.value.theme = codeBlockLightTheme; |
| 63 | +
|
| 64 | + if (val === 'dark') { |
| 65 | + codeBlockSettings.value.theme = codeBlockDarkTheme; |
| 66 | + } |
| 67 | +} |
181 | 68 |
|
182 | 69 | provide('drawerOptions', drawerOptions);
|
183 | 70 | provide('links', store.links);
|
184 |
| -provide('menuItems', menuItems); |
185 | 71 |
|
186 | 72 | function toggleDrawer() {
|
187 | 73 | drawer.value = !drawer.value;
|
|
0 commit comments