1111 <h1 v-if =" hasHeroText" class =" title" >{{ heroText }}</h1 >
1212 <p v-if =" hasTagline" class =" description" >{{ tagline }}</p >
1313
14- <div v-if =" hasAction" class =" action" >
15- <a class =" action-link" :href =" $frontmatter.actionLink" >
16- {{ $frontmatter.actionText }}
17- </a >
18- </div >
14+ <NavLink v-if =" hasAction" :item =" action" class =" action" />
1915 </header >
2016</template >
2117
2218<script setup lang="ts">
2319import { computed } from ' vue'
2420import { useSiteDataByRoute , useFrontmatter } from ' vitepress'
21+ import NavLink from ' ./NavLink.vue'
2522
2623const site = useSiteDataByRoute ()
2724const data = useFrontmatter ()
@@ -40,6 +37,10 @@ const hasTagline = computed(() => data.value.tagline !== null)
4037const tagline = computed (() => data .value .tagline || site .value .description )
4138
4239const hasAction = computed (() => data .value .actionLink && data .value .actionText )
40+ const action = computed (() => ({
41+ link: data .value .actionLink ,
42+ text: data .value .actionText ,
43+ }))
4344 </script >
4445
4546<style scoped>
@@ -115,7 +116,7 @@ const hasAction = computed(() => data.value.actionLink && data.value.actionText)
115116 }
116117}
117118
118- .action-link {
119+ .action ::v-deep( .item ) {
119120 display : inline-block ;
120121 border-radius : 4px ;
121122 padding : 0 20px ;
@@ -127,13 +128,14 @@ const hasAction = computed(() => data.value.actionLink && data.value.actionText)
127128 transition : background-color .1s ease ;
128129}
129130
130- .action-link :hover {
131+ .action ::v-deep( .item :hover ) {
131132 text-decoration : none ;
133+ color : #ffffff ;
132134 background-color : var (--c-brand-light );
133135}
134136
135137@media (min-width : 420px ) {
136- .action-link {
138+ .action ::v-deep( .item ) {
137139 padding : 0 24px ;
138140 line-height : 56px ;
139141 font-size : 1.2rem ;
0 commit comments