Skip to content

Commit

Permalink
fix: options issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrywu committed Oct 19, 2023
1 parent 323c2eb commit 123b85a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 26 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Language support: `angular` | `react` | `react-ts` | `vanilla` | `vanilla-ts` |
import { defineConfig } from 'vitepress';
import container from 'markdown-it-container';
import { renderSandbox } from 'vitepress-plugin-sandpack';
import 'vitepress-plugin-sandpack/dist/style.css';

// rule of 'html tag name' to 'component name'
// 'sanbox' -> 'Sandbox'
Expand Down
1 change: 1 addition & 0 deletions docs/docs/custom-usage/custom-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default {
import { defineConfig } from 'vitepress';
import container from 'markdown-it-container';
import { renderSandbox } from 'vitepress-plugin-sandpack';
import 'vitepress-plugin-sandpack/dist/style.css';

// rule of 'html tag name' to 'component name'
// 'sanbox' -> 'Sandbox'
Expand Down
1 change: 1 addition & 0 deletions docs/docs/custom-usage/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export default {
import { defineConfig } from 'vitepress';
import container from 'markdown-it-container';
import { renderSandbox } from 'vitepress-plugin-sandpack';
import 'vitepress-plugin-sandpack/dist/style.css';

// rule of 'html tag name' to 'component name'
// 'sanbox' -> 'Sandbox'
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/get-started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ We recommend converting your config to ESM `by either`:
```diff
import DefaultTheme from 'vitepress/theme';
+import { Sandbox } from 'vitepress-plugin-sandpack';
+import 'vitepress-plugin-sandpack/dist/style.css';

export default {
...DefaultTheme,
Expand All @@ -60,6 +61,7 @@ export default {
import { defineConfig } from 'vitepress';
import container from 'markdown-it-container';
import { renderSandbox } from 'vitepress-plugin-sandpack';
import 'vitepress-plugin-sandpack/dist/style.css';

// rule of 'html tag name' to 'component name'
// 'sanbox' -> 'Sandbox'
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"devDependencies": {
"highlight.js": "^11.9.0",
"vitepress": "^1.0.0-rc.21"
"vitepress": "^1.0.0-rc.22"
}
}
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"docs"
],
"scripts": {
"postinstall": "patch-package",
"build": "vite build",
"docs": "npm run docs:dev -w docs",
"build:docs": "npm run docs:build -w docs",
Expand All @@ -70,10 +69,10 @@
"sandpack-vue3": "^3.1.9"
},
"devDependencies": {
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"@commitlint/cli": "^17.8.0",
"@commitlint/config-conventional": "^17.8.0",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@vitejs/plugin-vue": "^4.4.0",
"@vue/eslint-config-typescript": "^12.0.0",
"babel-loader": "^9.1.3",
Expand All @@ -85,8 +84,7 @@
"eslint-plugin-vue": "^9.17.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"npm": "^10.2.0",
"patch-package": "^8.0.0",
"npm": "^10.2.1",
"typescript": "^5.2.2",
"vite-plugin-dts": "^3.6.0",
"vue-tsc": "^1.8.19"
Expand Down
13 changes: 0 additions & 13 deletions patches/vitepress+1.0.0-rc.20.patch

This file was deleted.

12 changes: 7 additions & 5 deletions src/components/Sandbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ const props = defineProps(sandboxProps);
const files = ref<SandpackFiles>({});
const editorVisible = computed(() => parsedBoolean(props.hideEditor) ? 'none' : 'flex');
const getOpt = (propName: string) => props[propName] || props?.options?.[propName];
const previewHeight = computed(() => isNaN(Number(props.previewHeight)) ? undefined : Number(props.previewHeight));
const editorVisible = computed(() => parsedBoolean(getOpt('hideEditor')) ? 'none' : 'flex');
const previewHeight = computed(() => isNaN(Number(getOpt('previewHeight'))) ? undefined : Number(getOpt('previewHeight')));
const previewHeightStyle =
computed(() => previewHeight.value ? `${previewHeight.value}px` : 'var(--sp-layout-height)');
const coderHeight = computed(() => isNaN(Number(props.coderHeight)) ? undefined : Number(props.coderHeight));
const coderHeight = computed(() => isNaN(Number(getOpt('coderHeight'))) ? undefined : Number(getOpt('coderHeight')));
const coderHeightStyle =
computed(() => coderHeight.value ? `${coderHeight.value}px` : 'var(--sp-layout-height)');
Expand All @@ -36,8 +38,8 @@ const isDark = ref(false);
const docsTheme = computed(
() => isDark.value
? (allThemes[props.darkTheme as Theme] || 'dark')
: (allThemes[props.lightTheme as Theme] || 'light'),
? (allThemes[getOpt('darkTheme') as Theme] || 'dark')
: (allThemes[getOpt('lightTheme') as Theme] || 'light'),
);
const resolveFiles = async () => {
Expand Down

0 comments on commit 123b85a

Please sign in to comment.