Skip to content

Commit 9a17ddf

Browse files
committed
feat: add altAction for home
1 parent 8a2ff33 commit 9a17ddf

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

src/client/theme-default/components/HomeHero.vue

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
<template>
22
<header v-if="showHero" class="home-hero">
33
<figure v-if="$frontmatter.heroImage" class="figure">
4-
<img
5-
class="image"
6-
:src="$withBase($frontmatter.heroImage)"
7-
:alt="$frontmatter.heroAlt"
8-
>
4+
<img class="image" :src="$withBase($frontmatter.heroImage)" :alt="$frontmatter.heroAlt" />
95
</figure>
106

117
<h1 v-if="hasHeroText" class="title">{{ heroText }}</h1>
128
<p v-if="hasTagline" class="description">{{ tagline }}</p>
139

14-
<NavLink v-if="hasAction" :item="action" class="action" />
10+
<NavLink
11+
v-if="hasAction"
12+
:item="{ link: data.actionLink, text: data.actionText }"
13+
class="action"
14+
/>
15+
16+
<NavLink
17+
v-if="hasAltAction"
18+
:item="{ link: data.altActionLink, text: data.altActionText }"
19+
class="action alt"
20+
/>
1521
</header>
1622
</template>
1723

@@ -37,10 +43,7 @@ const hasTagline = computed(() => data.value.tagline !== null)
3743
const tagline = computed(() => data.value.tagline || site.value.description)
3844
3945
const hasAction = computed(() => data.value.actionLink && data.value.actionText)
40-
const action = computed(() => ({
41-
link: data.value.actionLink,
42-
text: data.value.actionText,
43-
}))
46+
const hasAltAction = computed(() => data.value.altActionLink && data.value.altActionText)
4447
</script>
4548

4649
<style scoped>
@@ -93,7 +96,7 @@ const action = computed(() => ({
9396
9497
.description {
9598
margin: 0;
96-
margin-top: .25rem;
99+
margin-top: 0.25rem;
97100
line-height: 1.3;
98101
font-size: 1.2rem;
99102
color: var(--c-text-light);
@@ -108,24 +111,36 @@ const action = computed(() => ({
108111
109112
.action {
110113
margin-top: 1.5rem;
114+
display: inline-block;
115+
}
116+
117+
.action.alt {
118+
margin-left: 1.5rem;
111119
}
112120
113121
@media (min-width: 420px) {
114122
.action {
115123
margin-top: 2rem;
124+
display: inline-block;
116125
}
117126
}
118127
119128
.action :deep(.item) {
120129
display: inline-block;
121-
border-radius: 4px;
130+
border-radius: 6px;
122131
padding: 0 20px;
123-
line-height: 48px;
132+
line-height: 44px;
124133
font-size: 1rem;
125134
font-weight: 500;
126135
color: #ffffff;
127136
background-color: var(--c-brand);
128-
transition: background-color .1s ease;
137+
border: 2px solid var(--c-brand);
138+
transition: background-color 0.1s ease;
139+
}
140+
141+
.action.alt :deep(.item) {
142+
background-color: #fff;
143+
color: var(--c-brand);
129144
}
130145
131146
.action :deep(.item:hover) {
@@ -137,7 +152,7 @@ const action = computed(() => ({
137152
@media (min-width: 420px) {
138153
.action :deep(.item) {
139154
padding: 0 24px;
140-
line-height: 56px;
155+
line-height: 52px;
141156
font-size: 1.2rem;
142157
font-weight: 500;
143158
}

0 commit comments

Comments
 (0)