File tree Expand file tree Collapse file tree 4 files changed +63
-5
lines changed
Expand file tree Collapse file tree 4 files changed +63
-5
lines changed Original file line number Diff line number Diff line change 3939
4040<script setup>
4141import { useCoreStore } from ' @/stores/index' ;
42- import PlaygroundPage from ' @/playground/PlaygroundPage.vue' ;
42+ import PlaygroundPage from ' @/playground/PlaygroundPage.ts. vue' ;
4343import ThemeSelectComponent from ' @/documentation/components/ThemeSelectComponent.vue' ;
4444import AppBar from ' @/documentation/layout/AppBar.vue' ;
4545
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export CHECKMARK="$(printf '\e[1;32m\xE2\x9C\x94\e[0m')"
99PLAYGROUND_VUE_DIR=src/playground
1010
1111PLAYGROUND_VUE_FILE=PlaygroundPage.vue
12+ PLAYGROUND_TS_VUE_FILE=PlaygroundPage.ts.vue
1213
1314
1415# Check if Playground.vue file exists before trying to create it #
@@ -20,3 +21,12 @@ if [ ! -f "$PLAYGROUND_VUE_DIR/$PLAYGROUND_VUE_FILE" ]; then
2021 echo " "
2122fi
2223
24+ # Check if PlaygroundPage.ts.vue file exists before trying to create it #
25+ if [ ! -f " $PLAYGROUND_VUE_DIR /$PLAYGROUND_TS_VUE_FILE " ]; then
26+ cp " $PLAYGROUND_VUE_DIR /configs/templates/$PLAYGROUND_TS_VUE_FILE " " $PLAYGROUND_VUE_DIR /$PLAYGROUND_TS_VUE_FILE "
27+
28+ echo " "
29+ echo " ${BOLD_GREEN}${CHECKMARK}${BOLD_WHITE} $PLAYGROUND_TS_VUE_FILE file has been created.${WHITE} "
30+ echo " "
31+ fi
32+
Original file line number Diff line number Diff line change 1+ <template >
2+ <v-col cols =" 12" >
3+ <v-card elevation =" 5" >
4+ <v-container >
5+ <VCodeBlock
6+ :code =" options.code"
7+ :copy-button =" options.copyButton"
8+ :highlightjs =" options.highlightjs"
9+ :label =" options.label"
10+ :lang =" options.lang"
11+ :prismjs =" options.prismjs"
12+ :theme =" options.theme"
13+ >
14+ </VCodeBlock >
15+ </v-container >
16+ </v-card >
17+ </v-col >
18+ </template >
19+
20+ <script setup lang="ts">
21+ /* eslint-disable no-unused-vars */
22+ /* eslint-disable @typescript-eslint/no-unused-vars */
23+ const selectedLibrary = inject <Ref <{ id: string ; }>>(' selectedLibrary' );
24+ const selectedTheme = inject <Ref <string >>(' selectedTheme' );
25+
26+ let code = ` .foo {
27+ display: block;
28+ } ` ;
29+
30+ code = ` <div>
31+ Hello World
32+ </div> ` ;
33+
34+ code = ` const foo = 'bar'; ` ;
35+
36+ const options = computed (() => ({
37+ code ,
38+ copyButton: true ,
39+ highlightjs: selectedLibrary ?.value ?.id === ' highlightjs' ,
40+ label: ' Playground Example' ,
41+ lang: ' javascript' ,
42+ prismjs: selectedLibrary ?.value ?.id === ' prismjs' ,
43+ tabs: true ,
44+ theme: selectedTheme ?.value ,
45+ }));
46+ </script >
Original file line number Diff line number Diff line change 2323const selectedLibrary = inject (' selectedLibrary' );
2424const selectedTheme = inject (' selectedTheme' );
2525
26- const cssExample = ` .foo {
26+ let code = ` .foo {
2727 display: block;
2828}` ;
29- const htmlExample = ` <div>
29+
30+ code = ` <div>
3031 Hello World
3132</div>` ;
32- const jsExample = ` const foo = 'bar';` ;
33+
34+ code = ` const foo = 'bar';` ;
3335
3436const options = computed (() => ({
35- code: jsExample ,
37+ code,
3638 copyButton: true ,
3739 highlightjs: selectedLibrary .value ? .id === ' highlightjs' ,
3840 label: ' Playground Example' ,
You can’t perform that action at this time.
0 commit comments