feat: add altAction for home

pull/198/head
Evan You 4 years ago
parent 8a2ff33bf8
commit 9a17ddfdfb

@ -1,17 +1,23 @@
<template>
<header v-if="showHero" class="home-hero">
<figure v-if="$frontmatter.heroImage" class="figure">
<img
class="image"
:src="$withBase($frontmatter.heroImage)"
:alt="$frontmatter.heroAlt"
>
<img class="image" :src="$withBase($frontmatter.heroImage)" :alt="$frontmatter.heroAlt" />
</figure>
<h1 v-if="hasHeroText" class="title">{{ heroText }}</h1>
<p v-if="hasTagline" class="description">{{ tagline }}</p>
<NavLink v-if="hasAction" :item="action" class="action" />
<NavLink
v-if="hasAction"
:item="{ link: data.actionLink, text: data.actionText }"
class="action"
/>
<NavLink
v-if="hasAltAction"
:item="{ link: data.altActionLink, text: data.altActionText }"
class="action alt"
/>
</header>
</template>
@ -37,10 +43,7 @@ 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,
}))
const hasAltAction = computed(() => data.value.altActionLink && data.value.altActionText)
</script>
<style scoped>
@ -93,7 +96,7 @@ const action = computed(() => ({
.description {
margin: 0;
margin-top: .25rem;
margin-top: 0.25rem;
line-height: 1.3;
font-size: 1.2rem;
color: var(--c-text-light);
@ -108,24 +111,36 @@ const action = computed(() => ({
.action {
margin-top: 1.5rem;
display: inline-block;
}
.action.alt {
margin-left: 1.5rem;
}
@media (min-width: 420px) {
.action {
margin-top: 2rem;
display: inline-block;
}
}
.action :deep(.item) {
display: inline-block;
border-radius: 4px;
border-radius: 6px;
padding: 0 20px;
line-height: 48px;
line-height: 44px;
font-size: 1rem;
font-weight: 500;
color: #ffffff;
background-color: var(--c-brand);
transition: background-color .1s ease;
border: 2px solid var(--c-brand);
transition: background-color 0.1s ease;
}
.action.alt :deep(.item) {
background-color: #fff;
color: var(--c-brand);
}
.action :deep(.item:hover) {
@ -137,7 +152,7 @@ const action = computed(() => ({
@media (min-width: 420px) {
.action :deep(.item) {
padding: 0 24px;
line-height: 56px;
line-height: 52px;
font-size: 1.2rem;
font-weight: 500;
}

Loading…
Cancel
Save