Got the dropdown icon working (finally)

This commit is contained in:
ajdj100
2023-05-18 23:00:58 -04:00
parent 54738d2ec9
commit babb36f048
2 changed files with 16 additions and 3 deletions

View File

@@ -19,19 +19,25 @@ export default {
methods: { methods: {
toggle() { toggle() {
this.sharedState.active = !this.sharedState.active this.sharedState.active = !this.sharedState.active
},
away() {
this.sharedState.active = false
} }
}, },
components: { components: {
Icon Icon
},
props: {
title: String
} }
} }
</script> </script>
<template> <template>
<div id="button" @click="toggle"> <div id="button" @click="toggle" v-click-away="away">
<slot name="toggler"> <slot name="toggler">
<button> <button>
toggle <p>{{ title }}</p>
<Icon icon="carbon:caret-down" /> <Icon icon="carbon:caret-down" />
</button> </button>
@@ -48,5 +54,12 @@ button {
font-size: 15px; font-size: 15px;
padding: 10px; padding: 10px;
color: var(--white); color: var(--white);
display: flex;
flex-direction: row;
align-items: center;
}
p {
margin: 0 10px 0 0px;
} }
</style> </style>

View File

@@ -54,7 +54,7 @@ export default {
<option>RRC</option> <option>RRC</option>
</select> </select>
<dropdown> <dropdown title="hello">
<DropdownContent> <DropdownContent>
<DropdownItem>Item 1</DropdownItem> <DropdownItem>Item 1</DropdownItem>
<DropdownItem>Item 2</DropdownItem> <DropdownItem>Item 2</DropdownItem>