Skip to content

Commit

Permalink
Merge pull request #1554 from EnergySage/ced-1900-es-button-link-fix
Browse files Browse the repository at this point in the history
fix: support root-relative URLs in EsButton
  • Loading branch information
ericdouglaspratt authored Oct 24, 2024
2 parents 37758ec + 26ae29c commit 34c83e1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions es-ds-components/components/es-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,20 @@ const getRootClasses = computed(() => {
</script>

<template>
<!--
<a> is needed for href because a root-relative link like /market/start/
that is passed to <nuxt-link :to="" /> will attempt to internally navigate
within a micro frontend, which will result in a 404
-->
<a
v-if="props.href"
:class="getRootClasses"
:href="props.href">
<slot />
</a>
<nuxt-link
v-if="props.href || props.to"
:href="props.href || undefined"
:to="props.to || undefined"
v-else-if="props.to"
:to="props.to"
:class="getRootClasses">
<slot />
</nuxt-link>
Expand Down

0 comments on commit 34c83e1

Please sign in to comment.