ADD: richtext system
Added richtext system for better card content.
This commit is contained in:
parent
a325d52052
commit
932796aef1
2 changed files with 33 additions and 4 deletions
|
@ -8,15 +8,20 @@
|
|||
<div class="flex-col gap-default">
|
||||
<h3>{{skill.title}}</h3>
|
||||
<main class="flex-col gap-sm">
|
||||
<component v-for="({type, children, content, ...rest}, textIndex) in skill.text" :is="type" v-bind="rest">
|
||||
<component v-for="({type, content, ...rest}) in skill.text" :is="type" v-bind="rest">
|
||||
{{ content}}
|
||||
<template v-if="children">
|
||||
<template v-for="({type, content, ...rest}, childIndex) in children" :key="childIndex">
|
||||
<template v-if="'children' in rest && rest.children">
|
||||
<template v-for="({type, content, ...childRest}, childIndex) in rest.children" :key="childIndex">
|
||||
<template v-if="type === 'text'">
|
||||
{{ content }}
|
||||
</template>
|
||||
<template v-else-if="type === 'a'">
|
||||
<component :is="type" v-bind="childRest" class="inline-flex-row">
|
||||
{{ content}} <Icon v-if="'icon' in childRest && childRest.icon" :name="childRest.icon.name" mode="svg" :class="childRest.icon.position === 'end' && 'reverse'" />
|
||||
</component>
|
||||
</template>
|
||||
<template v-else>
|
||||
<component :is="type" v-bind="rest">
|
||||
<component :is="type" v-bind="childRest">
|
||||
{{ content}}
|
||||
</component>
|
||||
</template>
|
||||
|
@ -47,6 +52,10 @@ type RichTextLink = {
|
|||
type: 'a'
|
||||
content: string
|
||||
href: string
|
||||
icon ?: {
|
||||
name: string
|
||||
position : 'start' | 'end'
|
||||
}
|
||||
target ?: string
|
||||
class ?: string
|
||||
}
|
||||
|
@ -140,6 +149,10 @@ const skills : Skill[] = [
|
|||
target: '_blank',
|
||||
class: 'text',
|
||||
href: 'https://www.storyblok.com',
|
||||
icon: {
|
||||
name: 'ph:arrow-square-out-duotone',
|
||||
position: 'end',
|
||||
},
|
||||
content: 'Storyblok'
|
||||
},
|
||||
{
|
||||
|
@ -157,6 +170,10 @@ const skills : Skill[] = [
|
|||
target: '_blank',
|
||||
class: 'text',
|
||||
href: 'https://www.strapi.io',
|
||||
icon: {
|
||||
name: 'ph:arrow-square-out-duotone',
|
||||
position: 'end',
|
||||
},
|
||||
content: 'Strapi'
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue