feat(theme): add `home-hero-info` slot (#1807)

pull/2010/head
gaaming 2 years ago committed by GitHub
parent 2a1abbe45e
commit 996a5f47e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,6 +55,7 @@ provide('hero-image-slot-exists', heroImageSlotExists)
<VPContent> <VPContent>
<template #home-hero-before><slot name="home-hero-before" /></template> <template #home-hero-before><slot name="home-hero-before" /></template>
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template> <template #home-hero-image><slot name="home-hero-image" /></template>
<template #home-hero-after><slot name="home-hero-after" /></template> <template #home-hero-after><slot name="home-hero-after" /></template>
<template #home-features-before><slot name="home-features-before" /></template> <template #home-features-before><slot name="home-features-before" /></template>

@ -29,6 +29,7 @@ const NotFound = inject('NotFound')
<VPHome v-else-if="frontmatter.layout === 'home'"> <VPHome v-else-if="frontmatter.layout === 'home'">
<template #home-hero-before><slot name="home-hero-before" /></template> <template #home-hero-before><slot name="home-hero-before" /></template>
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template> <template #home-hero-image><slot name="home-hero-image" /></template>
<template #home-hero-after><slot name="home-hero-after" /></template> <template #home-hero-after><slot name="home-hero-after" /></template>
<template #home-features-before><slot name="home-features-before" /></template> <template #home-features-before><slot name="home-features-before" /></template>

@ -25,11 +25,13 @@ const heroImageSlotExists = inject('hero-image-slot-exists') as Ref<boolean>
<div class="VPHero" :class="{ 'has-image': image || heroImageSlotExists }"> <div class="VPHero" :class="{ 'has-image': image || heroImageSlotExists }">
<div class="container"> <div class="container">
<div class="main"> <div class="main">
<slot name="home-hero-info">
<h1 v-if="name" class="name"> <h1 v-if="name" class="name">
<span class="clip">{{ name }}</span> <span class="clip">{{ name }}</span>
</h1> </h1>
<p v-if="text" class="text">{{ text }}</p> <p v-if="text" class="text">{{ text }}</p>
<p v-if="tagline" class="tagline">{{ tagline }}</p> <p v-if="tagline" class="tagline">{{ tagline }}</p>
</slot>
<div v-if="actions" class="actions"> <div v-if="actions" class="actions">
<div v-for="action in actions" :key="action.link" class="action"> <div v-for="action in actions" :key="action.link" class="action">

@ -7,6 +7,7 @@ import VPHomeFeatures from './VPHomeFeatures.vue'
<div class="VPHome"> <div class="VPHome">
<slot name="home-hero-before" /> <slot name="home-hero-before" />
<VPHomeHero> <VPHomeHero>
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template> <template #home-hero-image><slot name="home-hero-image" /></template>
</VPHomeHero> </VPHomeHero>
<slot name="home-hero-after" /> <slot name="home-hero-after" />

@ -15,6 +15,7 @@ const { frontmatter: fm } = useData()
:image="fm.hero.image" :image="fm.hero.image"
:actions="fm.hero.actions" :actions="fm.hero.actions"
> >
<template #home-hero-info><slot name="home-hero-info" /></template>
<template #home-hero-image><slot name="home-hero-image" /></template> <template #home-hero-image><slot name="home-hero-image" /></template>
</VPHero> </VPHero>
</template> </template>

Loading…
Cancel
Save