Skip to content

Commit 6587169

Browse files
pkp/pkp-lib#10033 Fix button height for ellipsis menu (#482)
1 parent 5dd3bf6 commit 6587169

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

src/components/DropdownActions/DropdownActions.vue

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,22 @@
11
<template>
2-
<div class="relative inline-block items-start justify-between">
2+
<div
3+
class="relative inline-block items-start justify-between"
4+
:class="{'leading-none': displayAsEllipsis}"
5+
>
36
<Menu as="div">
4-
<div>
5-
<MenuButton
6-
class="hover:bg-gray-50 inline-flex w-full justify-center gap-x-1.5 rounded"
7-
:class="
8-
displayAsEllipsis
9-
? 'text-3xl-normal'
10-
: 'border border-light bg-secondary px-3 py-2 text-lg-normal'
11-
"
12-
:aria-label="ariaLabel || null"
13-
>
14-
<span v-if="!displayAsEllipsis">{{ label }}</span>
15-
<Icon
16-
v-if="!displayAsEllipsis"
17-
class="h-5 w-5 text-primary"
18-
icon="Dropdown"
19-
aria-hidden="true"
20-
/>
21-
<ButtonIcon
22-
v-else
23-
icon="MoreOptions"
24-
:aria-label="label"
25-
></ButtonIcon>
26-
</MenuButton>
27-
</div>
7+
<MenuButton
8+
:class="menuButtonStyle"
9+
:aria-label="displayAsEllipsis ? label : ariaLabel"
10+
>
11+
<span v-if="!displayAsEllipsis">{{ label }}</span>
12+
<Icon
13+
v-if="!displayAsEllipsis"
14+
class="h-5 w-5 text-primary"
15+
icon="Dropdown"
16+
aria-hidden="true"
17+
/>
18+
<Icon v-else class="h-6 w-6" icon="MoreOptions" aria-hidden="true" />
19+
</MenuButton>
2820

2921
<transition
3022
enter-active-class="transition ease-out duration-100"
@@ -80,10 +72,10 @@
8072
<script setup>
8173
import {Menu, MenuButton, MenuItem, MenuItems} from '@headlessui/vue';
8274
import PkpButton from '@/components/Button/Button.vue';
83-
import ButtonIcon from '@/components/ButtonIcon/ButtonIcon.vue';
8475
import Icon from '@/components/Icon/Icon.vue';
76+
import {computed} from 'vue';
8577
86-
defineProps({
78+
const props = defineProps({
8779
/**
8880
* An array of action objects.
8981
* Each object should contain
@@ -140,6 +132,16 @@ const emitAction = (action) => {
140132
}
141133
};
142134
135+
const menuButtonStyle = computed(() => ({
136+
// Base
137+
'hover:bg-gray-50 w-full justify-center rounded': true,
138+
// Default
139+
'inline-flex border border-light bg-secondary px-3 py-2 text-lg-normal gap-x-1.5':
140+
!props.displayAsEllipsis,
141+
// Ellipsis Menu
142+
'leading-none hover:text-on-dark hover:bg-hover': props.displayAsEllipsis,
143+
}));
144+
143145
const isValidAction = (action) => {
144146
return action?.label && (action?.url || action?.name);
145147
};

0 commit comments

Comments
 (0)