Support links without URLs provided

This commit is contained in:
koloml committed 2024-07-07 02:48:41 +04:00
1 parent 7eab8d633f
commit eae5016daa
2 files changed
+11 -13

No files matched your search

+2 -2
View File
@@ -9,11 +9,11 @@
display: flex;
flex-direction: column;
& > :global(a) {
& > :global(.menu-link) {
padding: 5px 24px;
}
:global(a) {
:global(.menu-link) {
color: colors.$text;
&:hover {
+9 -11
View File
@@ -1,8 +1,8 @@
<script>
/**
* @type {string}
* @type {string|null}
*/
export let href;
export let href = null;
/**
* @type {"tag"|"paint-brush"|"arrow-left"|"info-circle"|"wrench"|"globe"|"plus"|null}
@@ -15,19 +15,17 @@
export let target = undefined;
</script>
{#if href}
<a {href} {target} on:click>
{#if icon}
<i class="icon icon-{icon}"></i>
{/if}
<slot></slot>
</a>
{/if}
<svelte:element this="{href ? 'a': 'span'}" class="menu-link" {href} {target} on:click role="link" tabindex="0">
{#if icon}
<i class="icon icon-{icon}"></i>
{/if}
<slot></slot>
</svelte:element>
<style lang="scss">
@use '../../../styles/colors';
a {
.menu-link {
display: flex;
align-items: center;