1
- import clsx from 'clsx'
2
1
import { useColorMode } from '@docusaurus/theme-common'
3
2
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
4
3
import Layout from '@theme/Layout'
5
- import { SectionFeatures } from '@site/src/components/SectionFeatures'
4
+ import clsx from 'clsx'
5
+ import { useEffect , useState } from 'react'
6
6
7
+ import { SectionFeatures } from '../components/SectionFeatures'
7
8
import { DemoVideo } from '../components/DemoVideo'
8
9
import { SectionQuotes } from '../components/SectionQuotes'
9
10
import styles from './index.module.css'
@@ -96,9 +97,25 @@ export default function Home(): JSX.Element {
96
97
)
97
98
}
98
99
100
+ const STACKBLITZ_URL = 'https://stackblitz.com/edit/react-ts-pppzf5'
101
+ const STACKBLITZ_PARAMS = new URLSearchParams ( {
102
+ embed : '1' ,
103
+ file : 'playground.ts' ,
104
+ hideExplorer : '1' ,
105
+ hideNavigation : '1' ,
106
+ } )
107
+
99
108
function SectionPlayground ( ) {
100
109
const { colorMode } = useColorMode ( )
101
110
111
+ const [ src , setSrc ] = useState ( '' )
112
+
113
+ useEffect ( ( ) => {
114
+ STACKBLITZ_PARAMS . set ( 'theme' , colorMode )
115
+
116
+ setSrc ( `${ STACKBLITZ_URL } ?${ STACKBLITZ_PARAMS } ` )
117
+ } , [ colorMode ] )
118
+
102
119
return (
103
120
< section className = { styles . playgroundSection } >
104
121
< div className = { clsx ( 'container' , styles . playgroundContainer ) } >
@@ -110,7 +127,7 @@ function SectionPlayground() {
110
127
allow = "accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
111
128
className = { styles . playground }
112
129
sandbox = "allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
113
- src = { `https://stackblitz.com/edit/react-ts-pppzf5?embed=1&file=playground.ts&hideExplorer=1&hideNavigation=1&theme= ${ colorMode } ` }
130
+ src = { src }
114
131
title = "Kysely Demo"
115
132
/>
116
133
</ div >
0 commit comments