Updated LinkCard
LinkCard now uses vue-router when it is an internal resource
This commit is contained in:
parent
ca2f305a0a
commit
9edc8b71f7
|
@ -1,12 +1,34 @@
|
||||||
<template>
|
<template>
|
||||||
<a class="card" :href="link">
|
<a v-if="isExternal" target="_blank" rel="nofollow noreferrer" class="card" :href="to">
|
||||||
<p>{{ title }} →</p>
|
<p>{{ title }} →</p>
|
||||||
</a>
|
</a>
|
||||||
|
<router-link v-else v-bind="$props" class="card">
|
||||||
|
<p>{{ title }} →</p>
|
||||||
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { RouterLink } from 'vue-router';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['title', 'link'],
|
props: {
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
...RouterLink.props,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isExternal() {
|
||||||
|
return (
|
||||||
|
typeof this.to === 'string' && this.to.startsWith('http')
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -45,6 +67,5 @@ export default {
|
||||||
padding: 1.25rem;
|
padding: 1.25rem;
|
||||||
width: 9rem;
|
width: 9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,25 +13,22 @@ import '@/assets/styles/index.scss';
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<LinkCard
|
<LinkCard
|
||||||
title="Watch"
|
title="Watch"
|
||||||
link="https://www.netflix.com/title/81210762"
|
to="https://www.netflix.com/title/81210762"
|
||||||
/>
|
/>
|
||||||
<LinkCard title="Discord" link="https://discord.gg/hyKVDeRJ8Y" />
|
<LinkCard title="Discord" to="https://discord.gg/hyKVDeRJ8Y" />
|
||||||
<LinkCard
|
<LinkCard
|
||||||
title="Reddit"
|
title="Reddit"
|
||||||
link="https://www.reddit.com/r/YoungRoyals/"
|
to="https://www.reddit.com/r/YoungRoyals/"
|
||||||
/>
|
/>
|
||||||
<LinkCard
|
<LinkCard
|
||||||
title="Babbel (ref)"
|
title="Babbel (ref)"
|
||||||
link="https://www.talkable.com/x/IchxFl"
|
to="https://www.talkable.com/x/IchxFl"
|
||||||
/>
|
/>
|
||||||
<LinkCard
|
<LinkCard
|
||||||
title="Matrix →"
|
title="Matrix →"
|
||||||
link="https://matrix.to/#/#young-royals:matrix.org"
|
to="https://matrix.to/#/#young-royals:matrix.org"
|
||||||
/>
|
|
||||||
<LinkCard
|
|
||||||
title="Discord Utilities"
|
|
||||||
link="/utilities"
|
|
||||||
/>
|
/>
|
||||||
|
<LinkCard title="Discord Utilities" to="/utilities" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<h1 class="title">Utilities for the Discord Server</h1>
|
<h1 class="title">Utilities for the Discord Server</h1>
|
||||||
<LinkCard
|
<LinkCard
|
||||||
title="Birthdays"
|
title="Birthdays"
|
||||||
link="/utilities/birthdays"
|
to="/utilities/birthdays"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in a new issue