Skip to content

Commit

Permalink
Fix typescript for OverflowMenu (modrinth#3139)
Browse files Browse the repository at this point in the history
* Fix typescript for OverflowMenu

* Revert Discover content dropdown change to non-hoverable OverflowMenu

* Lint
  • Loading branch information
Prospector authored Jan 15, 2025
1 parent d670a5c commit e4cc8ef
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/ui/src/components/base/OverflowMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<template #menu>
<template v-for="(option, index) in options.filter((x) => x.shown === undefined || x.shown)">
<div
v-if="option.divider"
v-if="isDivider(option)"
:key="`divider-${index}`"
class="h-px mx-3 my-2 bg-button-bg"
></div>
Expand All @@ -25,15 +25,15 @@
:v-close-popper="!option.remainOnClick"
:action="
option.action
? (event) => {
option.action(event)
? (event: MouseEvent) => {
option.action?.(event)
if (!option.remainOnClick) {
close()
}
}
: null
: undefined
"
:link="option.link ? option.link : null"
:link="option.link ? option.link : undefined"
:external="option.external ? option.external : false"
:disabled="option.disabled"
@click="
Expand Down Expand Up @@ -67,7 +67,7 @@ interface Divider extends BaseOption {
interface Item extends BaseOption {
id: string
action?: () => void
action?: (event?: MouseEvent) => void
link?: string
external?: boolean
color?:
Expand Down Expand Up @@ -99,8 +99,8 @@ withDefaults(
{
options: () => [],
disabled: false,
dropdownId: null,
tooltip: null,
dropdownId: undefined,
tooltip: undefined,
},
)
Expand All @@ -118,6 +118,10 @@ const open = () => {
dropdown.value?.show()
}
function isDivider(option: BaseOption): option is Divider {
return 'divider' in option
}
defineExpose({ open, close })
</script>

Expand Down

0 comments on commit e4cc8ef

Please sign in to comment.