Fixed the custom dropdown menu, now I just need to style it.

This commit is contained in:
ajdj100
2023-05-19 23:22:09 -04:00
parent d38e41d90f
commit a0907bba4d
6 changed files with 109 additions and 22 deletions

View File

@@ -8,6 +8,7 @@
"name": "17th-website",
"version": "0.0.0",
"dependencies": {
"@headlessui/vue": "^1.7.13",
"@mahdikhashan/vue3-click-outside": "^0.1.2",
"vue": "^3.2.47",
"vue-router": "^4.2.0"
@@ -909,6 +910,17 @@
"@hapi/hoek": "^9.0.0"
}
},
"node_modules/@headlessui/vue": {
"version": "1.7.13",
"resolved": "https://registry.npmjs.org/@headlessui/vue/-/vue-1.7.13.tgz",
"integrity": "sha512-obG5TdPdBDfs+jiA1mY29LPFqyJl93Q90EL86ontfRe1B6XvbjPkx+x1aAC5DA18bXbb0Juni1ayDbXo0w1u0A==",
"engines": {
"node": ">=10"
},
"peerDependencies": {
"vue": "^3.2.0"
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
@@ -10012,6 +10024,12 @@
"@hapi/hoek": "^9.0.0"
}
},
"@headlessui/vue": {
"version": "1.7.13",
"resolved": "https://registry.npmjs.org/@headlessui/vue/-/vue-1.7.13.tgz",
"integrity": "sha512-obG5TdPdBDfs+jiA1mY29LPFqyJl93Q90EL86ontfRe1B6XvbjPkx+x1aAC5DA18bXbb0Juni1ayDbXo0w1u0A==",
"requires": {}
},
"@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",

View File

@@ -10,6 +10,7 @@
"format": "prettier --write src/"
},
"dependencies": {
"@headlessui/vue": "^1.7.13",
"@mahdikhashan/vue3-click-outside": "^0.1.2",
"vue": "^3.2.47",
"vue-router": "^4.2.0"

View File

@@ -46,6 +46,7 @@ export default {
</button>
</slot>
<slot />
</div>
</template>

View File

@@ -21,12 +21,9 @@ export default {
<style scoped>
div {
display: block;
/* flex-direction: column; */
width: 10%;
position: absolute;
background-color: var(--background-secondary);
border-radius: 0px 0px 10px 10px;
/* padding: 10px; */
}
</style>

View File

@@ -0,0 +1,35 @@
<template>
<Listbox v-model="selectedPerson">
<ListboxButton>{{ selectedPerson.name }}</ListboxButton>
<ListboxOptions>
<ListboxOption v-for="person in people" :key="person.id" :value="person" :disabled="person.unavailable">
{{ person.name }}
</ListboxOption>
</ListboxOptions>
</Listbox>
</template>
<script setup>
import { ref } from 'vue'
import {
Listbox,
ListboxButton,
ListboxOptions,
ListboxOption,
} from '@headlessui/vue'
const people = [
{ id: 1, name: 'Durward Reynolds', unavailable: false },
{ id: 2, name: 'Kenton Towne', unavailable: false },
{ id: 3, name: 'Therese Wunsch', unavailable: false },
{ id: 4, name: 'Benedict Kessler', unavailable: true },
{ id: 5, name: 'Katelyn Rohan', unavailable: false },
]
const selectedPerson = ref(people[0])
</script>
<script>
export default {
name: 'testDropdown'
}
</script>

View File

@@ -1,7 +1,8 @@
<script>
import Dropdown from '../components/dropdown/Dropdown.vue'
import DropdownContent from '../components/dropdown/DropdownContent.vue'
import DropdownItem from '../components/dropdown/DropDownItem.vue'
import { ref } from 'vue'
import { Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/vue'
import testDropdown from '../components/dropdown/testDropdown.vue'
export default {
data() {
return {
@@ -10,7 +11,18 @@ export default {
dropped: false,
search: '',
filter1: 'All Groups',
filter2: 'All Roles',
unitFilters: [
{ id: 1, name: 'All Groups', disabled: false },
{ id: 2, name: 'Alpha', disabled: false },
{ id: 3, name: 'Echo', disabled: false },
{ id: 4, name: 'HHC', disabled: false },
{ id: 5, name: 'Recruit', disabled: false },
],
unitFilter: { id: 1, name: 'All Groups', disabled: false },
}
},
methods: {
@@ -21,14 +33,21 @@ export default {
this.filter1 = 'All Groups'
this.filter2 = 'All Roles'
this.search = ''
this.unitFilter.id = 1
this.unitFilter.name = 'All Groups'
}
},
components: {
Dropdown,
DropdownContent,
DropdownItem
}
Listbox,
ListboxButton,
ListboxOption,
ListboxOptions,
testDropdown,
},
}
// const unitFilter = ref(unitFilters[1])
</script>
<template>
@@ -54,15 +73,17 @@ export default {
<option>RRC</option>
</select>
<dropdown title="All Groups">
<DropdownContent>
<DropdownItem>All Groups</DropdownItem>
<DropdownItem>Echo</DropdownItem>
<DropdownItem>HHC</DropdownItem>
<DropdownItem>Recruit</DropdownItem>
<DropdownItem>Discharged</DropdownItem>
</DropdownContent>
</dropdown>
<Listbox v-model="unitFilter">
<ListboxButton class="lbButton">
{{ unitFilter.name }}
<Icon icon="carbon:caret-down" />
</ListboxButton>
<ListboxOptions class="lbOptions">
<ListboxOption v-for="unit in unitFilters" :key="unit.id" :value="unit" :disabled="unit.disabled">
{{ unit.name }}
</ListboxOption>
</ListboxOptions>
</Listbox>
<!-- This button needs to get finished -->
<button @click="resetFilters()">Clear Filters</button>
@@ -94,6 +115,19 @@ export default {
<style>
@import '../assets/base.css';
.lbButton {
background-color: var(--background-secondary);
border: none;
border-radius: 5px;
}
.lbOptions {
background-color: var(--background-secondary);
display: block;
position: absolute;
}
button {
transition: all 0.2s ease-out;
cursor: pointer;
@@ -143,7 +177,8 @@ input {
display: flex;
}
#searchRow select, button {
#searchRow select,
button {
margin: 0 15px 0 0;
}