Skip to content

Commit

Permalink
Configurado menu em forma de componente
Browse files Browse the repository at this point in the history
  • Loading branch information
hermesalvesbr committed Nov 2, 2022
1 parent 0751eff commit e481b7b
Show file tree
Hide file tree
Showing 9 changed files with 510 additions and 10 deletions.
18 changes: 12 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"editor.formatOnPaste": false,
"editor.formatOnType": false,
"editor.formatOnSave": false,
"[vue]": {
"editor.formatOnType": false,
"editor.formatOnSave": false
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.associations": {
"*.css": "postcss"
},
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"typescript"
]
"javascriptvue",
"typescript",
"typescriptvue",
"vue"
],
}
4 changes: 2 additions & 2 deletions app.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<AppLayout>
<DashboardTop>
<NuxtPage />
</AppLayout>
</DashboardTop>
</template>
2 changes: 1 addition & 1 deletion components/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const { cover } = useAppConfig()
</script>

<style lang="postcss">
/** @apply bg-primary-50 dark:bg-primary-900; */
body {
@apply bg-primary-50
/** dark: bg-primary-900;*/
}
</style>
301 changes: 301 additions & 0 deletions components/DashboardTop.vue

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions components/dashboard/MenuApp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div class="space-y-1">
<a v-for="item in navigation" :key="item.name" :href="item.href" :class="[item.current ? 'bg-gray-200 text-gray-900' : 'text-gray-700 hover:text-gray-900 hover:bg-gray-50', 'group flex items-center px-2 py-2 text-sm font-medium rounded-md']" :aria-current="item.current ? 'page' : undefined">
<component :is="item.icon" :class="[item.current ? 'text-gray-500' : 'text-gray-400 group-hover:text-gray-500', 'mr-3 flex-shrink-0 h-6 w-6']" aria-hidden="true" />
{{ item.name }}
</a>
</div>
</template>
<script setup lang="ts">
import { type PropType } from 'vue'
export interface Teams {
name: String
href: String
bgColorClass: String
}
export interface Navigation {
name: String
href: String
current: String
}
// eslint-disable-next-line no-unused-vars
const props = defineProps({
teams: {
type: Object as PropType<Teams>,
required: false
},
navigation: {
type: Object as PropType<Navigation>,
required: true
}
})
</script>
79 changes: 79 additions & 0 deletions components/dashboard/MenuUser.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<Menu as="div" class="relative inline-block px-3 text-left">
<div>
<MenuButton class="group w-full rounded-md bg-gray-100 px-3.5 py-2 text-left text-sm font-medium text-gray-700 hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 focus:ring-offset-gray-100">
<span class="flex w-full items-center justify-between">
<span class="flex min-w-0 items-center justify-between space-x-3">
<img class="h-10 w-10 flex-shrink-0 rounded-full bg-gray-300" src="https://images.unsplash.com/photo-1502685104226-ee32379fefbe?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=3&w=256&h=256&q=80" alt="" />
<span class="flex min-w-0 flex-1 flex-col">
<span class="truncate text-sm font-medium text-gray-900">Jessy Schwarz</span>
<span class="truncate text-sm text-gray-500">@jessyschwarz</span>
</span>
</span>
<ChevronUpDownIcon class="h-5 w-5 flex-shrink-0 text-gray-400 group-hover:text-gray-500" aria-hidden="true" />
</span>
</MenuButton>
</div>
<transition enter-active-class="transition ease-out duration-100" enter-from-class="transform opacity-0 scale-95" enter-to-class="transform opacity-100 scale-100" leave-active-class="transition ease-in duration-75" leave-from-class="transform opacity-100 scale-100" leave-to-class="transform opacity-0 scale-95">
<MenuItems class="absolute right-0 left-0 z-10 mx-3 mt-1 origin-top divide-y divide-gray-200 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">View profile</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Settings</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Notifications</a>
</MenuItem>
</div>
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Get desktop app</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Support</a>
</MenuItem>
</div>
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Logout</a>
</MenuItem>
</div>
</MenuItems>
</transition>
</Menu>
</template>
<script setup lang="ts">
import { type PropType } from 'vue'
import {
Menu,
MenuButton,
MenuItem,
MenuItems
} from '@headlessui/vue'
import { ChevronUpDownIcon } from '@heroicons/vue/20/solid'
export interface Teams {
name: String
href: String
bgColorClass: String
}
export interface Navigation {
name: String
href: String
current: String
}
// eslint-disable-next-line no-unused-vars
const props = defineProps({
teams: {
type: Object as PropType<Teams>,
required: false
},
navigation: {
type: Object as PropType<Navigation>,
required: false
}
})
</script>
70 changes: 70 additions & 0 deletions components/dashboard/MenuUserMobile.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<template>
<Menu as="div" class="relative ml-3">
<div>
<MenuButton class="flex max-w-xs items-center rounded-full bg-white text-sm focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2">
<span class="sr-only">Open user menu</span>
<img class="h-8 w-8 rounded-full" src="https://images.unsplash.com/photo-1502685104226-ee32379fefbe?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="" />
</MenuButton>
</div>
<transition enter-active-class="transition ease-out duration-100" enter-from-class="transform opacity-0 scale-95" enter-to-class="transform opacity-100 scale-100" leave-active-class="transition ease-in duration-75" leave-from-class="transform opacity-100 scale-100" leave-to-class="transform opacity-0 scale-95">
<MenuItems class="absolute right-0 z-10 mt-2 w-48 origin-top-right divide-y divide-gray-200 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">View profile</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Settings</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Notifications</a>
</MenuItem>
</div>
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Get desktop app</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Support</a>
</MenuItem>
</div>
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']">Logout</a>
</MenuItem>
</div>
</MenuItems>
</transition>
</Menu>
</template>
<script setup lang="ts">
import { type PropType } from 'vue'
import {
Menu,
MenuButton,
MenuItem,
MenuItems
} from '@headlessui/vue'
export interface Teams {
name: String
href: String
bgColorClass: String
}
export interface Navigation {
name: String
href: String
current: String
}
// eslint-disable-next-line no-unused-vars
const props = defineProps({
teams: {
type: Object as PropType<Teams>,
required: false
},
navigation: {
type: Object as PropType<Navigation>,
required: false
}
})
</script>
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"lint": "npx eslint . --ext .js --ext .ts"
},
"dependencies": {
"@headlessui/vue": "^1.7.3",
"@heroicons/vue": "^2.0.13",
"@nuxt/content": "^2.2.0",
"@nuxtjs/color-mode": "^3.1.8",
"@nuxtjs/tailwindcss": "^6.0.1",
Expand All @@ -32,4 +34,4 @@
"standard-version": "^9.5.0",
"typescript": "^4.8.4"
}
}
}
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"

"@headlessui/vue@^1.7.3":
version "1.7.3"
resolved "https://yarn.softagon.io/@headlessui%2fvue/-/vue-1.7.3.tgz#116d13391552436ea1e9e88c69f0e9d7d2585c45"
integrity sha512-Is4iakKts9u9E0+jEZNzoJpBjwq2SamwEIoEl2RlyYSu6Zco536GsPXaQEfg/o7Eyc1GUUlcL+dJd4Rt7qyf7A==

"@heroicons/vue@^2.0.13":
version "2.0.13"
resolved "https://yarn.softagon.io/@heroicons%2fvue/-/vue-2.0.13.tgz#974c52abf8dab70e7d2a3a93d7fdadff4a0e9ec2"
integrity sha512-vVCVF02+rNKXEmanVNnmktJlxCbOn0qVFP1gfZPn4bcBIwPX3h9AVHGCkwly+IWDEME8w5oooG0KRd2hhSe/HQ==

"@humanwhocodes/config-array@^0.11.6":
version "0.11.7"
resolved "https://yarn.softagon.io/@humanwhocodes%2fconfig-array/-/config-array-0.11.7.tgz#38aec044c6c828f6ed51d5d7ae3d9b9faf6dbb0f"
Expand Down

0 comments on commit e481b7b

Please sign in to comment.