Skip to content

Commit b943211

Browse files
authored
docs: fix stackblitz theme out of sync. (#1183)
1 parent d86ccda commit b943211

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

site/src/pages/index.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
}
124124

125125
.playground {
126-
background-color: var(--gray12);
127126
border-radius: 8px;
128127
border: 1px solid var(--gray11);
129128
height: 100%;

site/src/pages/index.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import clsx from 'clsx'
21
import { useColorMode } from '@docusaurus/theme-common'
32
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
43
import Layout from '@theme/Layout'
5-
import { SectionFeatures } from '@site/src/components/SectionFeatures'
4+
import clsx from 'clsx'
5+
import { useEffect, useState } from 'react'
66

7+
import { SectionFeatures } from '../components/SectionFeatures'
78
import { DemoVideo } from '../components/DemoVideo'
89
import { SectionQuotes } from '../components/SectionQuotes'
910
import styles from './index.module.css'
@@ -96,9 +97,25 @@ export default function Home(): JSX.Element {
9697
)
9798
}
9899

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+
99108
function SectionPlayground() {
100109
const { colorMode } = useColorMode()
101110

111+
const [src, setSrc] = useState('')
112+
113+
useEffect(() => {
114+
STACKBLITZ_PARAMS.set('theme', colorMode)
115+
116+
setSrc(`${STACKBLITZ_URL}?${STACKBLITZ_PARAMS}`)
117+
}, [colorMode])
118+
102119
return (
103120
<section className={styles.playgroundSection}>
104121
<div className={clsx('container', styles.playgroundContainer)}>
@@ -110,7 +127,7 @@ function SectionPlayground() {
110127
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
111128
className={styles.playground}
112129
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}
114131
title="Kysely Demo"
115132
/>
116133
</div>

0 commit comments

Comments
 (0)