File tree 4 files changed +63
-5
lines changed
4 files changed +63
-5
lines changed Original file line number Diff line number Diff line change 39
39
40
40
<script setup>
41
41
import { useCoreStore } from ' @/stores/index' ;
42
- import PlaygroundPage from ' @/playground/PlaygroundPage.vue' ;
42
+ import PlaygroundPage from ' @/playground/PlaygroundPage.ts. vue' ;
43
43
import ThemeSelectComponent from ' @/documentation/components/ThemeSelectComponent.vue' ;
44
44
import AppBar from ' @/documentation/layout/AppBar.vue' ;
45
45
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')"
9
9
PLAYGROUND_VUE_DIR=src/playground
10
10
11
11
PLAYGROUND_VUE_FILE=PlaygroundPage.vue
12
+ PLAYGROUND_TS_VUE_FILE=PlaygroundPage.ts.vue
12
13
13
14
14
15
# Check if Playground.vue file exists before trying to create it #
@@ -20,3 +21,12 @@ if [ ! -f "$PLAYGROUND_VUE_DIR/$PLAYGROUND_VUE_FILE" ]; then
20
21
echo " "
21
22
fi
22
23
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 23
23
const selectedLibrary = inject (' selectedLibrary' );
24
24
const selectedTheme = inject (' selectedTheme' );
25
25
26
- const cssExample = ` .foo {
26
+ let code = ` .foo {
27
27
display: block;
28
28
}` ;
29
- const htmlExample = ` <div>
29
+
30
+ code = ` <div>
30
31
Hello World
31
32
</div>` ;
32
- const jsExample = ` const foo = 'bar';` ;
33
+
34
+ code = ` const foo = 'bar';` ;
33
35
34
36
const options = computed (() => ({
35
- code: jsExample ,
37
+ code,
36
38
copyButton: true ,
37
39
highlightjs: selectedLibrary .value ? .id === ' highlightjs' ,
38
40
label: ' Playground Example' ,
You can’t perform that action at this time.
0 commit comments