Skip to content

Commit

Permalink
fix(theme): the actionLink miss withBase (#168) (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolking authored Dec 5, 2020
1 parent 2bde6bf commit ffaca73
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/client/theme-default/components/HomeHero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@
<h1 v-if="hasHeroText" class="title">{{ heroText }}</h1>
<p v-if="hasTagline" class="description">{{ tagline }}</p>

<div v-if="hasAction" class="action">
<a class="action-link" :href="$frontmatter.actionLink">
{{ $frontmatter.actionText }}
</a>
</div>
<NavLink v-if="hasAction" :item="action" class="action" />
</header>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useSiteDataByRoute, useFrontmatter } from 'vitepress'
import NavLink from './NavLink.vue'
const site = useSiteDataByRoute()
const data = useFrontmatter()
Expand All @@ -40,6 +37,10 @@ const hasTagline = computed(() => data.value.tagline !== null)
const tagline = computed(() => data.value.tagline || site.value.description)
const hasAction = computed(() => data.value.actionLink && data.value.actionText)
const action = computed(() => ({
link: data.value.actionLink,
text: data.value.actionText,
}))
</script>

<style scoped>
Expand Down Expand Up @@ -115,7 +116,7 @@ const hasAction = computed(() => data.value.actionLink && data.value.actionText)
}
}
.action-link {
.action ::v-deep(.item) {
display: inline-block;
border-radius: 4px;
padding: 0 20px;
Expand All @@ -127,13 +128,14 @@ const hasAction = computed(() => data.value.actionLink && data.value.actionText)
transition: background-color .1s ease;
}
.action-link:hover {
.action ::v-deep(.item:hover) {
text-decoration: none;
color: #ffffff;
background-color: var(--c-brand-light);
}
@media (min-width: 420px) {
.action-link {
.action ::v-deep(.item) {
padding: 0 24px;
line-height: 56px;
font-size: 1.2rem;
Expand Down

1 comment on commit ffaca73

@vercel
Copy link

@vercel vercel bot commented on ffaca73 Dec 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.