Skip to content

Commit

Permalink
#223: Add solution for customization of the external links
Browse files Browse the repository at this point in the history
  • Loading branch information
mihailmarcu committed Mar 11, 2022
1 parent a848818 commit 455bb45
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 37 deletions.
13 changes: 10 additions & 3 deletions packages/template/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@
<SpNavbar
:links="navbarLinks"
:active-route="router.currentRoute.value.path"
/>
>
<template #externals>
<div class="dropdown-option mb-3">
<span> Support </span>
<SpExternalArrowIcon />
</div>
</template>
</SpNavbar>
<router-view />
</SpTheme>
</div>
</template>

<script lang="ts">
import { SpNavbar,SpTheme } from '@starport/vue'
import { SpExternalArrowIcon, SpNavbar, SpTheme } from '@starport/vue'
import { computed, onBeforeMount } from 'vue'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'
export default {
components: { SpTheme, SpNavbar },
components: { SpTheme, SpNavbar, SpExternalArrowIcon },
setup() {
// store
Expand Down
45 changes: 24 additions & 21 deletions packages/vue/src/components/SpAcc/SpAcc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,24 @@
<SpAccDropdown
v-if="state.accountDropdown"
:wallet="wallet"
:accName="getAccName()"
:acc-name="getAccName()"
@disconnect="disconnect"
@close="state.accountDropdown = false"
/>
>
<template #externals>
<slot name="externals"></slot>
</template>
</SpAccDropdown>
<SpModal
:visible="state.connectWalletModal"
:closeIcon="false"
:cancelButton="false"
:submitButton="false"
:close-icon="false"
:cancel-button="false"
:submit-button="false"
style="text-align: center"
@close="state.connectWalletModal = false"
@submit="state.connectWalletModal = false"
style="text-align: center"
>
<template v-slot:header>
<template #header>
<div v-if="state.modalPage === 'connect'">
<SpKeplrIcon />
<h3 v-if="isKeplrAvailable">Connect your wallet</h3>
Expand All @@ -53,7 +57,7 @@
<h3>Keplr cannot launch</h3>
</div>
</template>
<template v-slot:body>
<template #body>
<div style="max-width: 320px; text-align: center; margin: auto">
<div v-if="state.modalPage === 'connect'">
<p v-if="isKeplrAvailable">
Expand All @@ -72,8 +76,8 @@
<SpButton
aria-label="Cancel"
type="secondary"
@click="state.modalPage = 'connect'"
style="margin-top: 3rem"
@click="state.modalPage = 'connect'"
>
Cancel
</SpButton>
Expand All @@ -89,7 +93,7 @@
</div>
</div>
</template>
<template v-if="isKeplrAvailable" v-slot:footer>
<template v-if="isKeplrAvailable" #footer>
<div v-if="state.modalPage === 'connect'">
<SpButton
aria-label="Connect Keplr"
Expand Down Expand Up @@ -124,27 +128,26 @@
</template>

<script lang="ts">
import { defineComponent, reactive, computed, onMounted } from 'vue'
import { computed, defineComponent, onMounted,reactive } from 'vue'
import { useStore } from 'vuex'
import SpModal from '../SpModal'
import SpButton from '../SpButton'
import useKeplr from '../../composables/useKeplr'
import { Wallet } from '../../utils/interfaces'
import SpAccDropdown from '../SpAccDropdown'
import SpSpinner from '../SpSpinner'
import SpProfileIcon from '../SpProfileIcon'
import SpButton from '../SpButton'
import SpChevronDownIcon from '../SpChevronDown'
import SpExternalArrowIcon from '../SpExternalArrow'
import SpKeplrIcon from '../SpKeplrIcon'
import SpModal from '../SpModal'
import SpProfileIcon from '../SpProfileIcon'
import SpSpinner from '../SpSpinner'
import SpWarningIcon from '../SpWarningIcon'
import SpExternalArrowIcon from '../SpExternalArrow'
import SpChevronDownIcon from '../SpChevronDown'
import useKeplr from '../../composables/useKeplr'
import { Wallet } from '../../utils/interfaces'
export interface State {
modalPage: string
connectWalletModal: boolean
accountDropdown: boolean
keplrParams: { name: String; bech32Address: String }
keplrParams: { name: string; bech32Address: string }
}
export let initialState: State = {
Expand Down
26 changes: 14 additions & 12 deletions packages/vue/src/components/SpAccDropdown/SpAccDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@
<SpChevronRightIcon />
</div>
<hr class="divider" />
<div class="dropdown-option mb-3">
<span> Support </span>
<SpExternalArrowIcon />
</div>
<div class="dropdown-option mb-3">
<span> Twitter </span>
<SpExternalArrowIcon />
</div>
<div class="dropdown-option mb-3">
<span> Telegram </span>
<SpExternalArrowIcon />
</div>
<slot name='externals'>
<div class="dropdown-option mb-3">
<span> Support </span>
<SpExternalArrowIcon />
</div>
<div class="dropdown-option mb-3">
<span> Twitter </span>
<SpExternalArrowIcon />
</div>
<div class="dropdown-option mb-3">
<span> Telegram </span>
<SpExternalArrowIcon />
</div>
</slot>
<div style="text-align: center; margin-top: 2rem">
<span class="description-grey terms-link mr-2">Privacy</span>•
<span class="description-grey terms-link mr-2 ml-1">Terms of use</span>•
Expand Down
6 changes: 5 additions & 1 deletion packages/vue/src/components/SpNavbar/SpNavbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@
</router-link>
</div>
<div class="navbar-section">
<SpAcc />
<SpAcc>
<template #externals>
<slot name="externals"></slot>
</template>
</SpAcc>
</div>
</div>
</template>
Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export { default as SpCrudDelete } from './SpCrudDelete'
export { default as SpCrudRead } from './SpCrudRead'
export { default as SpCrudUpdate } from './SpCrudUpdate'
export { default as SpDropdown } from './SpDropdown'
export { default as SpExternalArrowIcon } from './SpExternalArrow'
export { default as SpGetTokenTransferList } from './SpGetTokenTransferList'
export { default as SpLinkIcon } from './SpLinkIcon'
export { default as SpModal } from './SpModal'
Expand Down

0 comments on commit 455bb45

Please sign in to comment.