storefront-ui icon indicating copy to clipboard operation
storefront-ui copied to clipboard

[BUG] SfLink purpose not clear from documentation

Open dsandber opened this issue 2 years ago • 2 comments

It's not clear when I should be using SfLink rather than NuxtLink. Do they do the same thing? Should SfLink be used for internal links (which don't cause a page reload) or for external links (which do cause a page reload) or both?

The documentation does not make this clear.

I looked at the commit that introduced SfLink but it didn't help -- in fact, I don't see how it creates a link at all since it doesn't seem to us an HTML a tag or a NuxtLink tag. That said, I know it works, I just don't understand how.

┆Issue is synchronized with this Jira Zadanie by Unito

dsandber avatar May 25 '22 14:05 dsandber

Hi, SfLink component changes depending on what you are using and if it's an internal or external link. So it could be nuxt-link if it's used in nuxt instance or router-link when it's used and internal or just a element otherwise. So it is done automatically for you. You can check it in code: https://github.com/vuestorefront/storefront-ui/blob/develop/packages/vue/src/components/atoms/SfLink/SfLink.vue

AdamPawlinski avatar Jun 06 '22 11:06 AdamPawlinski

Thanks, pull-request (for the next person) here: https://github.com/vuestorefront/storefront-ui/pull/2445

dsandber avatar Jun 14 '22 10:06 dsandber