-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new plugins & subgroups homepages
closes #1503
- Loading branch information
1 parent
9282224
commit 7ed0bb4
Showing
13 changed files
with
534 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,7 @@ $bd-gutter-x: 3rem; | |
|
||
h4 { | ||
padding-top: 1rem; | ||
color: $white; | ||
font-size: $h5-font-size; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<template> | ||
<div class="d-flex flex-column gap-4"> | ||
<slot v-if="description !== undefined" name="markdown" :content="description"/> | ||
<!-- Root plugin page with subgroups --> | ||
<template v-if="subGroup === undefined && plugins.length > 1"> | ||
<div class="d-flex flex-column"> | ||
<RowLink v-for="subGroupWrapper in subGroupsWrappers" | ||
:id="`group-${slugify(subGroupName(subGroupWrapper))}`" | ||
:iconB64Svg="'data:image/svg+xml;base64,' + icons[subGroupWrapper.subGroup]" | ||
:text="subGroupName(subGroupWrapper)" | ||
:href="subGroupHref(subGroupName(subGroupWrapper))" | ||
@click="$emit('goTo', {targetSubGroup: subGroupWrapper.subGroup})" | ||
/> | ||
</div> | ||
</template> | ||
<template v-else> | ||
<div class="d-flex flex-column elements-section" v-for="(elements, elementType) in elementsByType"> | ||
<h4 :id="`section-${slugify(elementType)}`">{{ elementType }}</h4> | ||
<div class="d-flex flex-column"> | ||
<RowLink v-for="element in elements" | ||
:id="slugify(element)" | ||
:iconB64Svg="'data:image/svg+xml;base64,' + icons[element]" | ||
:text="elementName(element)" | ||
:href="elementHref(element)" | ||
@click="$emit('goTo', {targetElement: element})" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import RowLink from "./RowLink.vue"; | ||
import type {Plugin} from "~/utils/plugins"; | ||
import {isEntryAPluginElementPredicate, subGroupName} from "~/utils/plugins"; | ||
import {slugify} from "~/utils/url.js"; | ||
const props = defineProps<{ | ||
plugins: Plugin[], | ||
pluginName: string, | ||
subGroup?: string | undefined, | ||
icons: Record<string, string> | ||
}>(); | ||
const plugin = computed(() => props.plugins.find(p => props.subGroup === undefined ? true : (slugify(subGroupName(p)) === props.subGroup))); | ||
const description = computed(() => plugin.value?.longDescription ?? plugin.value?.description); | ||
const subGroupsWrappers = computed(() => { | ||
return props.plugins | ||
.filter(p => p.name.toLowerCase() === props.pluginName.toLowerCase() && p.subGroup !== undefined); | ||
}); | ||
const elementName = (qualifiedName) => { | ||
let split = qualifiedName.split("."); | ||
return split?.[split.length - 1]?.capitalize(); | ||
} | ||
const {path} = useRoute(); | ||
const subGroupHref = (targetSubGroup) => `${path}/${slugify(targetSubGroup)}`; | ||
const elementHref = (element) => `${path}/${element}`; | ||
const extractPluginElements: Record<string, string[]> = (plugin: Plugin) => { | ||
return Object.fromEntries( | ||
Object.entries(plugin).filter(([key, value]) => isEntryAPluginElementPredicate(key, value)) | ||
.map(([key, value]) => [key.replaceAll(/[A-Z]/g, match => ` ${match}`).capitalize(), value]) | ||
); | ||
}; | ||
const elementsByType = computed(() => extractPluginElements(plugin.value)); | ||
defineEmits<{ | ||
goTo: [targetElement: string, targetSubGroup?: string] | ||
}>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<a :href="hrefWithDefault" class="row-link d-flex flex-grow-1 align-items-center gap-7 rounded"> | ||
<img :src="iconB64Svg" :alt="`${text} icon`"/>{{ text }} | ||
<ChevronRight class="ms-auto"/> | ||
</a> | ||
</template> | ||
<script setup lang="ts"> | ||
import ChevronRight from "vue-material-design-icons/ChevronRight.vue"; | ||
import {slugify} from "~/utils/url"; | ||
const props = defineProps<{ iconB64Svg: string, text: string, href?: string | undefined }>(); | ||
const {path} = useRoute(); | ||
const hrefWithDefault = computed(() => props.href === undefined ? `${path}/${slugify(props.text)}` : props.href); | ||
</script> | ||
<style lang="scss" scoped> | ||
.row-link { | ||
border-width: 1px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.