Skip to content

Commit 6e38928

Browse files
Merge pull request #7 from webdevnerdstuff/highlightjs
Adding back playground check for nav that magically disappeared
2 parents 2d9ff78 + 7a119ba commit 6e38928

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/components/DemoPage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const selectedTheme = ref('neon-bunny');
178178
179179
180180
onBeforeMount(() => {
181-
library.value = store.getLocalStorage() ?? store.setLocalStorage();
181+
library.value = store.getLocalStorage() ?? store.setLocalStorage('prism');
182182
changeLibrary(library.value);
183183
});
184184

src/components/Layout/NavBar.vue

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<fa-icon icon="fa-solid fa-house" />
2525
</a>
2626
</li>
27-
<li class="nav-item dropdown">
27+
<li v-if="!isPlayground" class="nav-item dropdown">
2828
<a
2929
id="docs-dropdown"
3030
aria-expanded="false"
@@ -86,7 +86,7 @@
8686
</li>
8787

8888
<!-- Examples -->
89-
<li class="nav-item dropdown">
89+
<li v-if="!isPlayground" class="nav-item dropdown">
9090
<a
9191
id="examples-dropdown"
9292
aria-expanded="false"
@@ -182,18 +182,24 @@
182182

183183
<script setup>
184184
import { inject, ref } from 'vue';
185+
import { useCoreStore } from '@/stores/index';
185186
186187
defineProps({
188+
isPlayground: {
189+
type: Boolean,
190+
default: false,
191+
},
187192
selectedLibrary: {
188193
type: Object,
189194
required: true,
190-
}
195+
},
191196
});
192197
193198
const links = inject('links');
194199
const prismLinks = inject('prismLinks');
195200
const highlightJsLinks = inject('highlightJsLinks');
196201
202+
const store = useCoreStore();
197203
const storedTheme = localStorage.getItem('theme');
198204
const pageTheme = ref(storedTheme);
199205
@@ -206,15 +212,7 @@ const getPreferredTheme = () => {
206212
};
207213
208214
const setTheme = function(theme) {
209-
if (theme === 'toggle') {
210-
pageTheme.value = pageTheme.value !== 'dark' ? 'dark' : 'light';
211-
}
212-
else {
213-
pageTheme.value = theme;
214-
}
215-
216-
document.documentElement.setAttribute('data-bs-theme', pageTheme.value);
217-
localStorage.setItem('theme', pageTheme.value);
215+
pageTheme.value = store.setTheme(theme, pageTheme.value);
218216
};
219217
220218
setTheme(getPreferredTheme());

0 commit comments

Comments
 (0)