Skip to content
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
74 changes: 43 additions & 31 deletions app/components/TeamsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,60 @@ defineProps<{
collapsed?: boolean
}>()

const teams = ref([{
label: 'Nuxt',
avatar: {
src: 'https://github.com/nuxt.png',
alt: 'Nuxt'
}
}, {
label: 'NuxtHub',
avatar: {
src: 'https://github.com/nuxt-hub.png',
alt: 'NuxtHub'
}
}, {
label: 'NuxtLabs',
avatar: {
src: 'https://github.com/nuxtlabs.png',
alt: 'NuxtLabs'
const teams = ref([
{
label: 'Nuxt',
avatar: {
src: 'https://github.com/nuxt.png',
alt: 'Nuxt'
}
},
{
label: 'NuxtHub',
avatar: {
src: 'https://github.com/nuxt-hub.png',
alt: 'NuxtHub'
}
},
{
label: 'NuxtLabs',
avatar: {
src: 'https://github.com/nuxtlabs.png',
alt: 'NuxtLabs'
}
}
}])
])
const selectedTeam = ref(teams.value[0])

const items = computed<DropdownMenuItem[][]>(() => {
return [teams.value.map(team => ({
...team,
onSelect() {
selectedTeam.value = team
}
})), [{
label: 'Create team',
icon: 'i-lucide-circle-plus'
}, {
label: 'Manage teams',
icon: 'i-lucide-cog'
}]]
return [
teams.value.map((team) => ({
...team,
onSelect() {
selectedTeam.value = team
}
})),
[
{
label: 'Create team',
icon: 'i-lucide-circle-plus'
},
{
label: 'Manage teams',
icon: 'i-lucide-cog'
}
]
]
})
</script>

<template>
<UDropdownMenu
:items="items"
:content="{ align: 'center', collisionPadding: 12 }"
:ui="{ content: collapsed ? 'w-40' : 'w-(--reka-dropdown-menu-trigger-width)' }"
:ui="{
content: collapsed ? 'w-40' : 'w-(--reka-dropdown-menu-trigger-width)'
}"
>
<UButton
v-bind="{
Expand Down
273 changes: 140 additions & 133 deletions app/components/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,159 +8,166 @@ defineProps<{
const colorMode = useColorMode()
const appConfig = useAppConfig()

const colors = ['red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose']
const colors = [
'red',
'orange',
'amber',
'yellow',
'lime',
'green',
'emerald',
'teal',
'cyan',
'sky',
'blue',
'indigo',
'violet',
'purple',
'fuchsia',
'pink',
'rose'
]
const neutrals = ['slate', 'gray', 'zinc', 'neutral', 'stone']

const user = ref({
name: 'Benjamin Canac',
avatar: {
src: 'https://github.com/benjamincanac.png',
alt: 'Benjamin Canac'
}
})
const { loadAuthUser, user } = useAuth()
await loadAuthUser()

const items = computed<DropdownMenuItem[][]>(() => ([[{
type: 'label',
label: user.value.name,
avatar: user.value.avatar
}], [{
label: 'Profile',
icon: 'i-lucide-user'
}, {
label: 'Billing',
icon: 'i-lucide-credit-card'
}, {
label: 'Settings',
icon: 'i-lucide-settings',
to: '/settings'
}], [{
label: 'Theme',
icon: 'i-lucide-palette',
children: [{
label: 'Primary',
slot: 'chip',
chip: appConfig.ui.colors.primary,
content: {
align: 'center',
collisionPadding: 16
},
children: colors.map(color => ({
label: color,
chip: color,
slot: 'chip',
checked: appConfig.ui.colors.primary === color,
type: 'checkbox',
onSelect: (e) => {
e.preventDefault()
// const user = ref({
// name: 'Benjamin Canac',
// avatar: {
// src: 'https://github.com/benjamincanac.png',
// alt: 'Benjamin Canac'
// }
// })

appConfig.ui.colors.primary = color
}
}))
}, {
label: 'Neutral',
slot: 'chip',
chip: appConfig.ui.colors.neutral === 'neutral' ? 'old-neutral' : appConfig.ui.colors.neutral,
content: {
align: 'end',
collisionPadding: 16
const items = computed<DropdownMenuItem[][]>(() => [
[
{
type: 'label',
label: user.value.email,
avatar: user.value.avatar
}
],
[
{
label: 'Perfil',
icon: 'i-lucide-user'
},
children: neutrals.map(color => ({
label: color,
chip: color === 'neutral' ? 'old-neutral' : color,
slot: 'chip',
type: 'checkbox',
checked: appConfig.ui.colors.neutral === color,
onSelect: (e) => {
e.preventDefault()
{
label: 'Ajustes',
icon: 'i-lucide-settings',
to: '/settings'
}
],
[
{
label: 'Tema',
icon: 'i-lucide-palette',
children: [
{
label: 'Primary',
slot: 'chip',
chip: appConfig.ui.colors.primary,
content: {
align: 'center',
collisionPadding: 16
},
children: colors.map((color) => ({
label: color,
chip: color,
slot: 'chip',
checked: appConfig.ui.colors.primary === color,
type: 'checkbox',
onSelect: (e) => {
e.preventDefault()

appConfig.ui.colors.neutral = color
}
}))
}]
}, {
label: 'Appearance',
icon: 'i-lucide-sun-moon',
children: [{
label: 'Light',
icon: 'i-lucide-sun',
type: 'checkbox',
checked: colorMode.value === 'light',
onSelect(e: Event) {
e.preventDefault()
appConfig.ui.colors.primary = color
}
}))
},
{
label: 'Neutral',
slot: 'chip',
chip:
appConfig.ui.colors.neutral === 'neutral'
? 'old-neutral'
: appConfig.ui.colors.neutral,
content: {
align: 'end',
collisionPadding: 16
},
children: neutrals.map((color) => ({
label: color,
chip: color === 'neutral' ? 'old-neutral' : color,
slot: 'chip',
type: 'checkbox',
checked: appConfig.ui.colors.neutral === color,
onSelect: (e) => {
e.preventDefault()

appConfig.ui.colors.neutral = color
}
}))
}
]
},
{
label: 'Aparência',
icon: 'i-lucide-sun-moon',
children: [
{
label: 'Clara',
icon: 'i-lucide-sun',
type: 'checkbox',
checked: colorMode.value === 'light',
onSelect(e: Event) {
e.preventDefault()

colorMode.preference = 'light'
colorMode.preference = 'light'
}
},
{
label: 'Escura',
icon: 'i-lucide-moon',
type: 'checkbox',
checked: colorMode.value === 'dark',
onUpdateChecked(checked: boolean) {
if (checked) {
colorMode.preference = 'dark'
}
},
onSelect(e: Event) {
e.preventDefault()
}
}
]
}
}, {
label: 'Dark',
icon: 'i-lucide-moon',
type: 'checkbox',
checked: colorMode.value === 'dark',
onUpdateChecked(checked: boolean) {
if (checked) {
colorMode.preference = 'dark'
],
[
{
label: 'Sair',
icon: 'i-lucide-log-out',
async onSelect() {
useAuth().logout()
await navigateTo('/login')
}
},
onSelect(e: Event) {
e.preventDefault()
}
}]
}], [{
label: 'Templates',
icon: 'i-lucide-layout-template',
children: [{
label: 'Starter',
to: 'https://starter-template.nuxt.dev/'
}, {
label: 'Landing',
to: 'https://landing-template.nuxt.dev/'
}, {
label: 'Docs',
to: 'https://docs-template.nuxt.dev/'
}, {
label: 'SaaS',
to: 'https://saas-template.nuxt.dev/'
}, {
label: 'Dashboard',
to: 'https://dashboard-template.nuxt.dev/',
color: 'primary',
checked: true,
type: 'checkbox'
}, {
label: 'Chat',
to: 'https://chat-template.nuxt.dev/'
}, {
label: 'Portfolio',
to: 'https://portfolio-template.nuxt.dev/'
}, {
label: 'Changelog',
to: 'https://changelog-template.nuxt.dev/'
}]
}], [{
label: 'Documentation',
icon: 'i-lucide-book-open',
to: 'https://ui.nuxt.com/docs/getting-started/installation/nuxt',
target: '_blank'
}, {
label: 'GitHub repository',
icon: 'i-simple-icons-github',
to: 'https://github.com/nuxt-ui-templates/dashboard',
target: '_blank'
}, {
label: 'Log out',
icon: 'i-lucide-log-out'
}]]))
]
])
</script>

<template>
<UDropdownMenu
:items="items"
:content="{ align: 'center', collisionPadding: 12 }"
:ui="{ content: collapsed ? 'w-48' : 'w-(--reka-dropdown-menu-trigger-width)' }"
:ui="{
content: collapsed ? 'w-48' : 'w-(--reka-dropdown-menu-trigger-width)'
}"
>
<UButton
v-bind="{
...user,
label: collapsed ? undefined : user?.name,
label: collapsed ? undefined : user?.email,
trailingIcon: collapsed ? undefined : 'i-lucide-chevrons-up-down'
}"
color="neutral"
Expand Down
Loading
Loading