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 an existing account and Sign out should be <button> #1382

Merged
merged 1 commit into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 10 additions & 5 deletions components/common/dropdown/DropdownItem.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<script setup lang="ts">
const props = defineProps<{
const props = withDefaults(defineProps<{
is?: string
text?: string
description?: string
icon?: string
checked?: boolean
command?: boolean
}>()
}>(), {
is: 'div',
})
const emit = defineEmits(['click'])

const { hide } = useDropdownContext() || {}
Expand Down Expand Up @@ -39,8 +42,10 @@ useCommand({
</script>

<template>
<div
v-bind="$attrs" ref="el"
<component
v-bind="$attrs"
:is="is"
ref="el"
flex gap-3 items-center cursor-pointer px4 py3
select-none
hover-bg-active
Expand All @@ -67,5 +72,5 @@ useCommand({

<div v-if="checked" i-ri:check-line />
<slot name="actions" />
</div>
</component>
</template>
2 changes: 2 additions & 0 deletions components/user/UserSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ const clickUser = (user: UserLogin) => {
</template>
<div border="t base" pt2>
<CommonDropdownItem
is="button"
:text="$t('user.add_existing')"
icon="i-ri:user-add-line"
@click="openSigninDialog"
/>
<CommonDropdownItem
is="button"
v-if="isHydrated && currentUser"
:text="$t('user.sign_out_account', [getFullHandle(currentUser.account)])"
icon="i-ri:logout-box-line rtl-flip"
Expand Down