|
|
|
@ -4,62 +4,72 @@ const userIcon = ref()
|
|
|
|
const showUserOptions = ref<Boolean>(false)
|
|
|
|
const showUserOptions = ref<Boolean>(false)
|
|
|
|
|
|
|
|
|
|
|
|
const toggleUserOptions = () => {
|
|
|
|
const toggleUserOptions = () => {
|
|
|
|
showUserOptions.value = !showUserOptions.value
|
|
|
|
showUserOptions.value = !showUserOptions.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onClickOutside(
|
|
|
|
onClickOutside(
|
|
|
|
userOptionsCard,
|
|
|
|
userOptionsCard,
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
|
toggleUserOptions()
|
|
|
|
toggleUserOptions()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ ignore: [userIcon] }
|
|
|
|
{ ignore: [userIcon] }
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const logout = async () => {
|
|
|
|
const logout = async () => {
|
|
|
|
await userLogout()
|
|
|
|
await userLogout()
|
|
|
|
useRouter().push('/login')
|
|
|
|
useRouter().push('/login')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type UserOption = {
|
|
|
|
type UserOption = {
|
|
|
|
title: string
|
|
|
|
title: string
|
|
|
|
function: () => void
|
|
|
|
function: () => void
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const userOptions: Array<UserOption> = [
|
|
|
|
const userOptions: Array<UserOption> = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: 'Github',
|
|
|
|
title: 'Github',
|
|
|
|
function: () => {
|
|
|
|
function: () => {
|
|
|
|
openUrl('https://github.com/TZGyn')
|
|
|
|
openUrl('https://github.com/TZGyn')
|
|
|
|
toggleUserOptions()
|
|
|
|
toggleUserOptions()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: 'Log Out',
|
|
|
|
title: 'Log Out',
|
|
|
|
function: async () => {
|
|
|
|
function: async () => {
|
|
|
|
await logout()
|
|
|
|
await logout()
|
|
|
|
toggleUserOptions()
|
|
|
|
toggleUserOptions()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
class="fixed top-0 flex h-16 w-screen items-center justify-between border-b-2 border-b-lightgray bg-secondary px-4">
|
|
|
|
class="flex h-14 w-screen items-center justify-between bg-primary px-4">
|
|
|
|
<div class="flex gap-4">
|
|
|
|
<div class="relative">
|
|
|
|
<Icon name="twitter" />
|
|
|
|
<Icon
|
|
|
|
<div class="font-bold"> Twitter Clone </div>
|
|
|
|
name="user"
|
|
|
|
</div>
|
|
|
|
size="36"
|
|
|
|
<div class="relative">
|
|
|
|
ref="userIcon"
|
|
|
|
<Icon name="user" size="28" ref="userIcon" @click="toggleUserOptions()" />
|
|
|
|
@click="toggleUserOptions()" />
|
|
|
|
<div v-if="showUserOptions" ref="userOptionsCard"
|
|
|
|
<div
|
|
|
|
class="absolute right-0 top-8 w-max border border-lightgray bg-secondary">
|
|
|
|
v-if="showUserOptions"
|
|
|
|
<div v-for="userOption in userOptions"
|
|
|
|
ref="userOptionsCard"
|
|
|
|
class="w-full min-w-[120px] border border-lightgray p-4 text-center hover:bg-lightgray"
|
|
|
|
class="absolute left-0 top-8 w-max border border-lightgray bg-secondary">
|
|
|
|
@click="userOption.function()">
|
|
|
|
<div
|
|
|
|
{{ userOption.title }}
|
|
|
|
v-for="userOption in userOptions"
|
|
|
|
</div>
|
|
|
|
class="w-full min-w-[120px] border border-lightgray p-4 text-center hover:bg-lightgray"
|
|
|
|
</div>
|
|
|
|
@click="userOption.function()">
|
|
|
|
</div>
|
|
|
|
{{ userOption.title }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="flex gap-4">
|
|
|
|
|
|
|
|
<Icon
|
|
|
|
|
|
|
|
name="twitter"
|
|
|
|
|
|
|
|
size="28"
|
|
|
|
|
|
|
|
class="text-sky-500" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="invisible h-8 w-8"></div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|