-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create card has quick description of the page
- Loading branch information
Showing
18 changed files
with
248 additions
and
10 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
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 |
---|---|---|
@@ -1,14 +1,61 @@ | ||
<script setup lang="ts"> | ||
import { DocHeader } from '@portfolio/api-client'; | ||
import PageTechnoChip from './PageTechnoChip.vue'; | ||
defineProps<{ | ||
metadata: DocHeader; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<div class="pageHeader"> | ||
<h1>{{ metadata.title }}</h1> | ||
<p>{{ metadata.date }}</p> | ||
<Card> | ||
<template #header> | ||
<div class="flex justify-between px-4 pt-2"> | ||
<a target="_blank" rel="noreferrer" :href="metadata.writter.url" class="flex items-center gap-2"> | ||
<Avatar :image="metadata.writter.avatar" size="xlarge" /> | ||
<p class="font-bold text-2xl">{{ metadata.writter.name }}</p> | ||
</a> | ||
<div> | ||
<p>{{ metadata.date }}</p> | ||
</div> | ||
</div> | ||
</template> | ||
<template #title> | ||
<h1>{{ metadata.title }}</h1> | ||
</template> | ||
<template #subtitle> | ||
<p>{{ metadata.description }}</p> | ||
</template> | ||
<template #content> | ||
<p></p> | ||
<Panel v-if="metadata.techno !== undefined && metadata.techno.length > 0" toggleable header="Techno"> | ||
|
||
<div class="pageHeaderTechno"> | ||
<PageTechnoChip v-for="techno in metadata.techno" :key="techno" :technoName="techno" /> | ||
</div> | ||
</Panel> | ||
<Panel v-if="metadata.tags !== undefined && metadata.tags.length > 0" toggleable header="Tag"> | ||
<div class="pageHeaderTag"> | ||
<Chip v-for="tag in metadata.tags" :key="tag" :label="tag" /> | ||
</div> | ||
</Panel> | ||
<Panel v-if="metadata.links !== undefined && metadata.links.length > 0" toggleable header="Link"> | ||
<div class="pageHeaderLink"> | ||
<a v-for="link in metadata.links" :key="link.url" :href="link.url" target="_blank"> | ||
<Chip :label="link.name" /> | ||
</a> | ||
</div> | ||
</Panel> | ||
</template> | ||
</Card> | ||
</div> | ||
</template> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.pageHeaderTechno, | ||
.pageHeaderTag, | ||
.pageHeaderLink { | ||
@apply flex flex-wrap gap-2; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup lang="ts"> | ||
import { RouterLink } from 'vue-router'; | ||
import { useDocStore } from '../../stores/doc'; | ||
const props = defineProps<{ | ||
technoName: string, | ||
}>(); | ||
const docStore = useDocStore(); | ||
const techno = docStore.technoExists(props.technoName); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<RouterLink v-if="techno" :to="{ name: 'doccontent', params: { page: techno.path.split('/') } }"> | ||
<Chip :label="props.technoName" /> | ||
</RouterLink> | ||
<Chip v-else :label="props.technoName" /> | ||
</div> | ||
</template> |
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,29 @@ | ||
export type Link = { | ||
url: string; | ||
text: string; | ||
}; | ||
|
||
export const detectLink = (text: string) => { | ||
const textUrlArray = []; | ||
const urlMdRegex = /\[(\?'text'[^\]]+)\]\((\?'url'[^)]+)\)/g; | ||
while (urlMdRegex.exec(text)) { | ||
textUrlArray.push({ | ||
text: RegExp.$1, | ||
url: RegExp.$2, | ||
}); | ||
} | ||
const urlMdRegex2 = /<(\?'text'[^\]]+)>/g; | ||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
const matched = urlMdRegex2.exec(text); | ||
if (!matched) break; | ||
textUrlArray.push({ | ||
text: matched[1], | ||
url: matched[1], | ||
}); | ||
const splitText = text.split(`<${matched[1]}>`); | ||
textUrlArray.push(splitText[0]); | ||
|
||
text = splitText.slice(1).join(''); | ||
} | ||
}; |
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,31 @@ | ||
export type TextSpec = { | ||
start: number; | ||
stop: number; | ||
isLink: boolean; | ||
url?: string; | ||
isBold: boolean; | ||
isItalic: boolean; | ||
isCode: boolean; | ||
}; | ||
|
||
export const detectTextSpec = (text: string) => { | ||
const textUrlArray = []; | ||
const urlMdRegex = /\[(\?'text'[^\]]+)\]\((\?'url'[^)]+)\)/g; | ||
while (urlMdRegex.exec(text)) { | ||
textUrlArray.push({ | ||
text: RegExp.$1, | ||
url: RegExp.$2, | ||
}); | ||
} | ||
const urlMdRegex2 = /<(\?'text'[^\]]+)>/g; | ||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
text.search(urlMdRegex2); | ||
const matched = urlMdRegex2.exec(text); | ||
if (!matched) break; | ||
const splitText = text.split(`<${matched[1]}>`); | ||
textUrlArray; | ||
|
||
text = splitText.slice(1).join(''); | ||
} | ||
}; |
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
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
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
Oops, something went wrong.