Overflow dropdown menu
This commit is contained in:
parent
ccc41f96d8
commit
739af21519
1 changed files with 10 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useReposStore } from "@/stores/repos";
|
import { useReposStore } from "@/stores/repos";
|
||||||
import { offset, useFloating } from "@floating-ui/vue";
|
import { offset, size, useFloating } from "@floating-ui/vue";
|
||||||
import {
|
import {
|
||||||
RiAddLine,
|
RiAddLine,
|
||||||
RiArrowDropDownLine,
|
RiArrowDropDownLine,
|
||||||
|
|
@ -18,7 +18,14 @@ const reference = useTemplateRef("reference");
|
||||||
const floating = useTemplateRef("floating");
|
const floating = useTemplateRef("floating");
|
||||||
const { floatingStyles } = useFloating(reference, floating, {
|
const { floatingStyles } = useFloating(reference, floating, {
|
||||||
placement: "bottom-start",
|
placement: "bottom-start",
|
||||||
middleware: [offset(4)],
|
middleware: [
|
||||||
|
offset(4),
|
||||||
|
size({
|
||||||
|
apply({ availableHeight, elements }) {
|
||||||
|
elements.floating.style.maxHeight = `${Math.max(100, availableHeight)}px`;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
function onAddNewRepo() {
|
function onAddNewRepo() {
|
||||||
|
|
@ -65,7 +72,7 @@ function onSelectRepo(id: string) {
|
||||||
<div
|
<div
|
||||||
v-if="open"
|
v-if="open"
|
||||||
ref="floating"
|
ref="floating"
|
||||||
class="absolute left-0 top-0 w-fit min-w-48 rounded-md bg-neutral-800 font-light"
|
class="absolute left-0 top-0 w-fit min-w-48 overflow-auto rounded-md bg-neutral-800 font-light"
|
||||||
:style="floatingStyles"
|
:style="floatingStyles"
|
||||||
>
|
>
|
||||||
<NavbarDropdownEntry
|
<NavbarDropdownEntry
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue