Skip to content

Commit 657042a

Browse files
Adding documentation
1 parent 6389a0c commit 657042a

File tree

11 files changed

+545
-95
lines changed

11 files changed

+545
-95
lines changed

src/App.vue

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<template>
22
<v-app id="home">
33
<!-- ====================================================== App Bar -->
4-
<AppBar @updated-drawer="toggleDrawer" />
4+
<AppBar
5+
@changed-theme="updateCodeBlockTheme"
6+
@updated-drawer="toggleDrawer"
7+
/>
58

69
<!-- ====================================================== Navigation Drawer -->
710
<v-navigation-drawer
@@ -17,7 +20,7 @@
1720
<v-main class="main-container pb-10">
1821
<v-responsive>
1922
<v-container class="px-10">
20-
<DocsPage />
23+
<DocsPage :codeBlockOptions="codeBlockSettings" />
2124
</v-container>
2225
</v-responsive>
2326
</v-main>
@@ -30,6 +33,9 @@ import AppBar from './documentation/layout/AppBar.vue';
3033
import MenuComponent from './documentation/components/MenuComponent.vue';
3134
import DocsPage from './documentation/DocsPage.vue';
3235
import { useCoreStore } from './stores/index';
36+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
37+
import Prism from 'prismjs';
38+
import 'prismjs/components/prism-typescript.js';
3339
3440
3541
const store = useCoreStore();
@@ -40,6 +46,23 @@ const drawerOptions = ref({
4046
elevation: 10,
4147
});
4248
49+
const codeBlockPlugin = 'prismjs';
50+
const codeBlockLightTheme = 'tomorrow';
51+
const codeBlockDarkTheme = 'tomorrow';
52+
53+
const codeBlockSettings = ref({
54+
plugin: codeBlockPlugin,
55+
theme: codeBlockDarkTheme,
56+
});
57+
58+
function updateCodeBlockTheme(val) {
59+
codeBlockSettings.value.theme = codeBlockLightTheme;
60+
61+
if (val === 'dark') {
62+
codeBlockSettings.value.theme = codeBlockDarkTheme;
63+
}
64+
}
65+
4366
provide('drawerOptions', drawerOptions);
4467
provide('links', store.links);
4568

src/documentation/DocsPage.vue

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
<v-col cols="12">
4343
<CodeBlock
4444
code="pnpm add vuetify-drilldown-table"
45-
highlightjs
45+
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
4646
lang="plain"
47+
:prismjs="codeBlockSettings.plugin === 'prismjs'"
48+
:theme="codeBlockSettings.theme"
4749
>
4850
<template #label>
4951
Using <a
@@ -56,8 +58,10 @@
5658
<v-col cols="12">
5759
<CodeBlock
5860
code="npm i vuetify-drilldown-table"
59-
highlightjs
61+
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
6062
lang="plain"
63+
:prismjs="codeBlockSettings.plugin === 'prismjs'"
64+
:theme="codeBlockSettings.theme"
6165
>
6266
<template #label>Using npm:</template>
6367
</CodeBlock>
@@ -70,16 +74,19 @@
7074
<DescriptionSection />
7175

7276
<!-- Usage -->
73-
<UsageSection />
77+
<UsageSection :codeBlockOptions="codeBlockOptions" />
7478

7579
<!-- Props -->
7680
<PropsSection />
7781

82+
<!-- Cell Rendering -->
83+
<CellRenderingSection :codeBlockOptions="codeBlockOptions" />
84+
7885
<!-- Events -->
7986
<EventsSection />
8087

8188
<!-- Slots -->
82-
<SlotsSection />
89+
<SlotsSection :codeBlockOptions="codeBlockOptions" />
8390

8491
<!-- Example -->
8592
<ExampleSection />
@@ -99,6 +106,7 @@
99106
import { inject, provide, reactive, ref } from 'vue';
100107
import packageInfo from '../../package.json';
101108
import {
109+
CellRenderingSection,
102110
DependenciesSection,
103111
DescriptionSection,
104112
EventsSection,
@@ -110,6 +118,15 @@ import {
110118
UsageSection,
111119
} from '@/documentation/sections';
112120
121+
122+
const props = defineProps({
123+
codeBlockOptions: {
124+
required: true,
125+
type: Object,
126+
},
127+
});
128+
129+
const codeBlockSettings = computed(() => props.codeBlockOptions);
113130
const links = inject('links');
114131
115132
const classes = reactive({

src/documentation/layout/AppBar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ function getTheme() {
144144
function setTheme() {
145145
themeName.value = store.setTheme(themeName.value);
146146
theme.global.name.value = themeName.value;
147+
emit('changedTheme', themeName.value);
147148
}
148149
149150
function toggleDrawer() {

0 commit comments

Comments
 (0)