Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add solution for customization of the external links #259

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/template/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
:active-route="router.currentRoute.value.path"
>
<template #externals>
<div class="dropdown-option mb-3">
<span> Support </span>
<SpExternalArrowIcon />
</div>
<SpAccDropdownExternalLink title='Support' link=''/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make links point to Starport properties by default, so https://discord.gg/ignt, https://twitter.com/starporthq, https://starport.com

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean like this:

<SpAccDropdownExternalLink title='Discord' link='https://discord.gg/ignt'/>
<SpAccDropdownExternalLink title='Twitter' link='https://twitter.com/starporthq'/>
<SpAccDropdownExternalLink title='Starport' link='https://starport.com/'/>

<SpAccDropdownExternalLink title='Twitter' link=''/>
<SpAccDropdownExternalLink title='Telegram' link=''/>
</template>
</SpNavbar>
<router-view />
Expand All @@ -18,13 +17,13 @@
</template>

<script lang="ts">
import { SpExternalArrowIcon, SpNavbar, SpTheme } from '@starport/vue'
import { SpAccDropdownExternalLink, SpNavbar, SpTheme } from '@starport/vue'
import { computed, onBeforeMount } from 'vue'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'

export default {
components: { SpTheme, SpNavbar, SpExternalArrowIcon },
components: { SpTheme, SpNavbar, SpAccDropdownExternalLink },

setup() {
// store
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<a class="dropdown-option mb-3" :href='link' :target='target'>
<span v-text='title'></span>
<SpExternalArrowIcon v-if='hasIcon' />
</a>
</template>

<script lang="ts">
import {
defineComponent,
} from 'vue'

import SpExternalArrowIcon from '../SpExternalArrow'

export default defineComponent({
name: 'SpAccDropdownExternalLink',

components: {
SpExternalArrowIcon,
},

props: {
title: {
type: String,
required: true
},
link: {
type: String,
required: true
},
target: {
type: String,
default: '_blank'
},
hasIcon: {
type: Boolean,
default: true
},
},
})
</script>

<style lang='scss' scoped>
.dropdown-option {
color: #111111;
text-decoration: none;
}
</style>
13 changes: 13 additions & 0 deletions packages/vue/src/components/SpAccDropdownExternalLink/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { App as Application } from 'vue'

import { registerComponent } from './../../utils/plugins/index'
// @ts-ignore
import C from './SpAccDropdownExternalLink.vue'

export const Plugin = {
install(vue: Application): void {
registerComponent(vue, C)
}
}

export default C
1 change: 1 addition & 0 deletions packages/vue/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as SpAcc } from './SpAcc'
export { default as SpAccDropdownExternalLink } from './SpAccDropdownExternalLink'
export { default as SpAmountSelect } from './SpAmountSelect'
export { default as SpAssets } from './SpAssets'
export { default as SpButton } from './SpButton'
Expand Down