-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<template> | ||
<div v-on-clickaway="away" :class="elClass"> | ||
Check warning on line 2 in webapp/src/components/AppDropdown.vue GitHub Actions / build
|
||
<bunt-button @click="toggle"> | ||
<slot name="toggler"> Toggle </slot> | ||
Check warning on line 4 in webapp/src/components/AppDropdown.vue GitHub Actions / build
Check warning on line 4 in webapp/src/components/AppDropdown.vue GitHub Actions / build
|
||
<svg | ||
v-if="this.sharedState.active" | ||
Check warning on line 6 in webapp/src/components/AppDropdown.vue GitHub Actions / build
|
||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" | ||
height="1em" | ||
viewBox="0 0 24 24" | ||
> | ||
<path fill="currentColor" d="m7 15l5-5l5 5z" /> | ||
</svg> | ||
<svg | ||
v-else | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1em" | ||
height="1em" | ||
viewBox="0 0 24 24" | ||
> | ||
<path fill="currentColor" d="m7 10l5 5l5-5z" /> | ||
</svg> | ||
</bunt-button> | ||
<slot /> | ||
</div> | ||
</template> | ||
<script> | ||
import { computed } from 'vue'; | ||
Check failure on line 28 in webapp/src/components/AppDropdown.vue GitHub Actions / build
Check failure on line 28 in webapp/src/components/AppDropdown.vue GitHub Actions / build
|
||
import { mixin as clickaway } from 'vue-clickaway' | ||
export default { | ||
name: 'AppDropdown', | ||
mixins: [clickaway], | ||
props: { | ||
className: { | ||
type: String, | ||
default: '', | ||
}, | ||
}, | ||
provide () { | ||
return { | ||
sharedState: this.sharedState | ||
} | ||
}, | ||
data () { | ||
return { | ||
sharedState: { | ||
active: false, | ||
}, | ||
} | ||
}, | ||
methods: { | ||
toggle () { | ||
this.sharedState.active = !this.sharedState.active | ||
}, | ||
away () { | ||
this.sharedState.active = false | ||
} | ||
}, | ||
computed: { | ||
elClass () { | ||
return this.className ? this.className + " app-drop-down" : 'app-drop-down' | ||
}, | ||
} | ||
} | ||
</script> | ||
<style> | ||
.app-drop-down { | ||
margin: 12px 4px 12px 14px; | ||
border-radius: 5px; | ||
border: 2px solid rgba(0, 0, 0, 0.38); | ||
} | ||
.app-drop-down .bunt-button { | ||
background-color: white; | ||
} | ||
.app-drop-down .bunt-button .bunt-button-content { | ||
text-transform: capitalize; | ||
} | ||
</style> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<template> | ||
<transition :name="elClass"> | ||
<div v-if="active" :class="elClass" @click.stop> | ||
<slot /> | ||
</div> | ||
</transition> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'AppDropdownContent', | ||
inject: ['sharedState'], | ||
props: { | ||
className: { | ||
type: String, | ||
default: '', | ||
}, | ||
}, | ||
computed: { | ||
active () { | ||
return this.sharedState.active | ||
}, | ||
elClass () { | ||
return this.className ? this.className + " dropdown-content" : 'dropdown-content' | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style> | ||
.dropdown-content { | ||
position: absolute; | ||
margin-top: 4px; | ||
left: 0; | ||
right: 0; | ||
width: 100%; | ||
max-width: none; | ||
min-width: 400px; | ||
border: 1px solid rgba(0, 0, 0, 0.38); | ||
background-color: #fff; | ||
z-index: 1000; | ||
max-height: 350px; | ||
overflow-y: auto; | ||
padding-bottom: 10px; | ||
} | ||
.dropdown-content .checkbox-line { | ||
margin: 8px; | ||
} | ||
.dropdown-content .checkbox-line .bunt-checkbox .bunt-checkbox-box { | ||
min-width: 20px; | ||
} | ||
.dropdown-content-enter-active, | ||
.dropdown-content-leave-active { | ||
transition: all 0.2s; | ||
} | ||
.dropdown-content-enter, | ||
.dropdown-content-leave-to { | ||
opacity: 0; | ||
transform: translateY(-5px); | ||
} | ||
.checkbox-text { | ||
margin-left: 10px; | ||
flex: 1; | ||
white-space: normal; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
text-align: left; | ||
} | ||
@media (max-width: 480px) { | ||
.dropdown-content { | ||
width: 70vw; | ||
left: 5vw; | ||
right: auto; | ||
max-width: calc(100% - 40px); | ||
min-width: 350px; | ||
margin-left: -20px; | ||
position: fixed; | ||
} | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<div> | ||
<slot/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "AppDropdownItem" | ||
}; | ||
</script> |