Skip to content

Commit

Permalink
🐛 (sandbox) fix sandbox component
Browse files Browse the repository at this point in the history
  • Loading branch information
Tahul committed Jul 1, 2021
1 parent ee5dc06 commit 866e62e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/defaultTheme/components/atoms/Sandbox.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div ref="box" class="w-full min-h-[500px] mx-auto mb-6 overflow-hidden text-3xl rounded-md sandbox">
<TabsHeader ref="tabs-header" :active-tab-index="activeTabIndex" :tabs="providersTabs" @update="updateTab">
<TabsHeader v-if="!src" :active-tab-index="activeTabIndex" :tabs="providersTabs" @update="updateTab">
<div slot="footer" class="absolute top-1/2 transform -translate-y-1/2 right-0 px-2">
<Link class="flex items-center text-gray-500 dark:text-gray-400" :to="url" blank>
<IconExternalLink class="h-5 w-5" />
Expand Down Expand Up @@ -45,20 +45,24 @@ export default defineComponent({
type: String,
default: undefined
},
/**
* Target directory inside that repository
*/
dir: {
type: String,
default: undefined
}
},
setup(props) {
const { $docus, $colorMode } = useContext()
const repository = props.repo || $docus.settings.github?.repo
const providers = {
CodeSandBox: () =>
`https://codesandbox.io/embed/github/${repository}/tree/${props.branch}/${props.dir}?hidenavigation=1&theme=${$colorMode.value}`,
`https://codesandbox.io/embed/github/${props.repository}/tree/${props.branch}/${props.dir}?hidenavigation=1&theme=${$colorMode.value}`,
StackBlitz: () =>
`https://stackblitz.com/github/${repository}/tree/${props.branch}/${props.dir}?embed=1&hideExplorer=1&hideNavigation=1&theme=${$colorMode.value}`
`https://stackblitz.com/github/${props.repository}/tree/${props.branch}/${props.dir}?embed=1&hideExplorer=1&hideNavigation=1&theme=${$colorMode.value}`
}
const providersTabs = Object.keys(providers).map(p => ({ label: p }))
const box = ref()
const activeTabIndex = ref(0)
Expand Down

0 comments on commit 866e62e

Please sign in to comment.