feat(home): add target and rel attribute to home actions (#3528)

pull/3542/head
Liana 5 months ago committed by GitHub
parent 30c665b29d
commit ab39fd8592
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -69,6 +69,12 @@ interface HeroAction {
// Destination link of the button.
link: string
// Link target attribute.
target?: string
// Link rel attribute.
rel?: string
}
```
@ -144,6 +150,9 @@ interface Feature {
//
// e.g. `external`
rel?: string
// Link target attribute for the `link` option.
target?: string
}
type FeatureIcon =

@ -9,6 +9,8 @@ interface Props {
theme?: 'brand' | 'alt' | 'sponsor'
text: string
href?: string
target?: string;
rel?: string;
}
const props = withDefaults(defineProps<Props>(), {
size: 'medium',
@ -30,8 +32,8 @@ const component = computed(() => {
class="VPButton"
:class="[size, theme]"
:href="href ? normalizeLink(href) : undefined"
:target="isExternal ? '_blank' : undefined"
:rel="isExternal ? 'noreferrer' : undefined"
:target="props.target ?? (isExternal ? '_blank' : undefined)"
:rel="props.rel ?? (isExternal ? 'noreferrer' : undefined)"
>
{{ text }}
</component>

@ -8,6 +8,8 @@ export interface HeroAction {
theme?: 'brand' | 'alt'
text: string
link: string
target?: string
rel?: string
}
defineProps<{
@ -43,6 +45,8 @@ const heroImageSlotExists = inject('hero-image-slot-exists') as Ref<boolean>
:theme="action.theme"
:text="action.text"
:href="action.link"
:target="action.target"
:rel="action.rel"
/>
</div>
</div>

Loading…
Cancel
Save