File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed
apps/website/src/components Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { extractThemeCSS } from '@qwik-ui/utils';
5
5
import { LuX } from '@qwikest/icons/lucide' ;
6
6
import { useTheme } from 'qwik-themes' ;
7
7
import globalCSS from '~/global.css?raw' ;
8
+ import { Highlight } from '../highlight/highlight' ;
8
9
9
10
export default component$ ( ( ) => {
10
11
const showSig = useSignal ( false ) ;
@@ -17,34 +18,30 @@ export default component$(() => {
17
18
< >
18
19
< Button
19
20
onClick$ = { ( ) => {
20
- showSig . value = true ;
21
21
cssThemeOutput . value = extractThemeCSS (
22
22
theme === 'dark' || theme === 'light'
23
23
? 'border-radius-0 simple primary-cyan-600 light base-slate'
24
24
: theme ,
25
25
globalCSS ,
26
26
) ;
27
+ showSig . value = true ;
27
28
} }
28
29
>
29
30
Copy code
30
31
</ Button >
31
32
< Modal
32
33
bind :show = { showSig }
33
- class = "my-animation h-full max-w-2xl overflow-x-hidden rounded-base bg-background p-8 text-foreground shadow-md backdrop:backdrop-blur backdrop:backdrop-brightness-50 dark:backdrop:backdrop-brightness-100"
34
+ class = "my-animation h-[650px] max-w-2xl overflow-x-hidden rounded-base p-8 shadow-md backdrop:backdrop-blur backdrop:backdrop-brightness-50 dark:backdrop:backdrop-brightness-100"
34
35
>
35
36
< ModalHeader >
36
- < h2 class = "text-lg font-bold" > Copy config</ h2 >
37
- < p >
37
+ < h2 class = "mb-2 text-lg font-bold" > Copy config</ h2 >
38
+ < p class = "mb-6" >
38
39
Copy and paste the following code into your global.css file to apply the
39
40
styles.
40
41
</ p >
41
42
</ ModalHeader >
42
- < ModalContent class = "mb-2 pb-4 pt-2" >
43
- < div >
44
- < pre >
45
- < code > { cssThemeOutput . value } </ code >
46
- </ pre >
47
- </ div >
43
+ < ModalContent >
44
+ < Highlight code = { cssThemeOutput . value } language = "css" />
48
45
</ ModalContent >
49
46
< button
50
47
onClick$ = { ( ) => ( showSig . value = false ) }
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ export const Highlight = component$(
31
31
} : HighlightProps ) => {
32
32
const codeSig = useSignal ( '' ) ;
33
33
34
+ useVisibleTask$ ( ( { track } ) => {
35
+ track ( ( ) => codeSig . value ) ;
36
+ console . log ( 'codeSig changed: ' , codeSig . value ) ;
37
+ } ) ;
38
+
34
39
const addShiki$ = $ ( async ( ) => {
35
40
let modifiedCode : string = code ;
36
41
@@ -67,15 +72,17 @@ export const Highlight = component$(
67
72
codeSig . value = str . toString ( ) ;
68
73
} ) ;
69
74
70
- useTask$ ( async function createHighlightedCode ( ) {
75
+ useTask$ ( async ( { track } ) => {
76
+ track ( ( ) => code ) ;
71
77
if ( ! isDev ) {
72
78
await addShiki$ ( ) ;
73
79
}
74
80
} ) ;
75
81
76
82
// eslint-disable-next-line qwik/no-use-visible-task
77
83
useVisibleTask$ (
78
- async ( ) => {
84
+ async ( { track } ) => {
85
+ track ( ( ) => code ) ;
79
86
if ( isDev ) {
80
87
await addShiki$ ( ) ;
81
88
}
You can’t perform that action at this time.
0 commit comments