Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): Improve directory structure pages by adding links (fix: #…
- Loading branch information
1 parent
69872e8
commit 585a05b
Showing
3 changed files
with
104 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,61 @@ | ||
<template lang="pug"> | ||
q-tree.doc-tree(:nodes="nodes" node-key="id" children-key="c" default-expand-all dense) | ||
template("v-slot:default-header"="prop") | ||
.row.items-center.no-wrap | ||
.doc-tree__label.text-weight-bold.text-no-wrap | ||
doc-link(v-if="prop.node.r" :to="prop.node.r") {{ prop.node.l }} | ||
template(v-else) {{ prop.node.l }} | ||
.doc-tree__explanation.text-grey.q-ml-sm(v-if="prop.node.e") # {{ prop.node.e }} | ||
</template> | ||
<template> | ||
<q-tree | ||
class="doc-tree" | ||
:nodes="nodes" | ||
node-key="id" | ||
children-key="c" | ||
default-expand-all | ||
dense | ||
> | ||
<template v-slot:default-header="prop"> | ||
<div class="row items-center no-wrap"> | ||
<div class="doc-tree__label text-weight-bold text-no-wrap">{{ prop.node.l }}</div> | ||
|
||
<q-btn | ||
v-if="prop.node.url" | ||
class="doc-tree__btn q-ml-xs" | ||
size="9px" | ||
color="brand-primary" | ||
:icon="mdiLaunch" | ||
unelevated | ||
dense | ||
:href="prop.node.url" | ||
target="_blank" | ||
@click.stop | ||
/> | ||
|
||
<script> | ||
export default { | ||
name: 'DocTree', | ||
<div class="doc-tree__explanation text-grey q-ml-sm" v-if="prop.node.e"># {{ prop.node.e }}</div> | ||
</div> | ||
</template> | ||
</q-tree> | ||
</template> | ||
|
||
props: { | ||
def: Object | ||
}, | ||
<script setup> | ||
import { mdiLaunch } from '@quasar/extras/mdi-v6' | ||
setup (props) { | ||
let id = 0 | ||
const addId = node => { | ||
node.id = id++ | ||
if (node.c !== void 0) { | ||
node.l += '/' | ||
node.c.forEach(addId) | ||
} | ||
return node | ||
} | ||
const props = defineProps({ | ||
def: Object | ||
}) | ||
return { | ||
nodes: [addId(props.def)] | ||
} | ||
let id = 0 | ||
const addId = node => { | ||
node.id = id++ | ||
if (node.c !== void 0) { | ||
node.l += '/' | ||
node.c.forEach(addId) | ||
} | ||
return node | ||
} | ||
const nodes = [addId(props.def)] | ||
</script> | ||
|
||
<style lang="sass"> | ||
.doc-tree | ||
&__label | ||
font-size: .9em | ||
&__btn .q-icon | ||
font-size: 12px | ||
&__explanation | ||
font-size: .7em | ||
& .q-icon | ||
font-size: 0.9em | ||
margin-top: -2px | ||
</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
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