Skip to content

Commit

Permalink
Merge pull request #164 from RDFLib/ashley-fix-nav-reads-props
Browse files Browse the repository at this point in the history
Reorder declaration of props in MainNav.vue, to _before_ it is read.
  • Loading branch information
ashleysommer authored Jun 26, 2024
2 parents 067ab41 + 6e0d291 commit 7816224
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/navs/MainNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ const activePrez = computed(() => {
return enabledPrezs.value.find(prez => route.path === `/${prez.toLowerCase()[0]}` || route.path.startsWith(`/${prez.toLowerCase()[0]}/`));
});
const props = defineProps<{
sidenav: boolean;
version: string;
}>();
const collapse = ref(false);
const dropdowns = ref(enabledPrezs.value.reduce<{[key: string]: boolean}>((obj, prez) => (obj[prez] = props.sidenav ? prez === activePrez.value : false, obj), {})); // { CatPrez: false, ... }
Expand All @@ -80,11 +86,6 @@ watch(() => route.path, (newValue) => {
}
});
const props = defineProps<{
sidenav: boolean;
version: string;
}>();
function closeDropdowns() {
if (!Object.values(dropdowns.value).every(isOpen => !isOpen)) { // if any are true
Object.keys(dropdowns.value).forEach(prez => dropdowns.value[prez] = false); // set all to false
Expand Down

0 comments on commit 7816224

Please sign in to comment.