Skip to content

Commit

Permalink
✨ feat: add hero slots that are inside container (#3524)
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki authored Jan 31, 2024
1 parent 6b1f951 commit 28870e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/guide/extending-default-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ Full list of slots available in the default theme layout:
- `aside-ads-after`
- When `layout: 'home'` is enabled via frontmatter:
- `home-hero-before`
- `home-hero-info-before`
- `home-hero-info`
- `home-hero-actions-after`
- `home-hero-image`
- `home-hero-after`
- `home-features-before`
Expand Down
2 changes: 2 additions & 0 deletions docs/zh/guide/extending-default-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ export default {
- `aside-ads-after`
-`layout: 'home'` 在 frontmatter 中被启用时:
- `home-hero-before`
- `home-hero-info-before`
- `home-hero-info`
- `home-hero-actions-after`
- `home-hero-image`
- `home-hero-after`
- `home-features-before`
Expand Down
3 changes: 3 additions & 0 deletions src/client/theme-default/components/VPHero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ const heroImageSlotExists = inject('hero-image-slot-exists') as Ref<boolean>
<div class="VPHero" :class="{ 'has-image': image || heroImageSlotExists }">
<div class="container">
<div class="main">
<slot name="home-hero-info-before" />
<slot name="home-hero-info">
<h1 v-if="name" class="name">
<span v-html="name" class="clip"></span>
</h1>
<p v-if="text" v-html="text" class="text"></p>
<p v-if="tagline" v-html="tagline" class="tagline"></p>
</slot>
<slot name="home-hero-info-after" />

<div v-if="actions" class="actions">
<div v-for="action in actions" :key="action.link" class="action">
Expand All @@ -44,6 +46,7 @@ const heroImageSlotExists = inject('hero-image-slot-exists') as Ref<boolean>
/>
</div>
</div>
<slot name="home-hero-actions-after" />
</div>

<div v-if="image || heroImageSlotExists" class="image">
Expand Down

0 comments on commit 28870e6

Please sign in to comment.