pleroma-fe/src/components/status_action_buttons/action_button.vue

88 lines
2.5 KiB
Vue
Raw Normal View History

2025-01-12 18:49:44 +02:00
<template>
<div
class="action-button"
:class="buttonClass"
>
2025-01-12 18:49:44 +02:00
<component
:is="getComponent(button)"
class="action-button-inner"
:class="buttonInnerClass"
2025-01-12 18:49:44 +02:00
role="menuitem"
:tabindex="0"
2025-01-13 22:32:39 +02:00
:disabled="buttonClass.disabled"
2025-01-12 18:49:44 +02:00
:href="getComponent(button) == 'a' ? button.link?.(funcArg) || getRemoteInteractionLink : undefined"
@click.stop="getComponent(button) === 'button' && doAction(button)"
@click="close"
>
<FALayers>
<FAIcon
class="fa-scale-110"
:icon="button.icon(funcArg)"
:spin="!extra && button.animated?.() && animationState[button.name]"
2025-01-13 22:32:39 +02:00
fixed-width
2025-01-12 18:49:44 +02:00
/>
2025-01-13 22:32:39 +02:00
<template v-if="!buttonClass.disabled && button.toggleable?.(funcArg) && button.active">
2025-01-12 18:49:44 +02:00
<FAIcon
v-if="button.active(funcArg)"
class="active-marker"
2025-01-13 22:32:39 +02:00
transform="shrink-6 up-9 right-15"
2025-01-12 18:49:44 +02:00
:icon="button.activeIndicator?.(funcArg) || 'check'"
/>
<FAIcon
v-if="!button.active(funcArg)"
class="focus-marker"
2025-01-13 22:32:39 +02:00
transform="shrink-6 up-9 right-15"
2025-01-12 18:49:44 +02:00
:icon="button.openIndicator?.(funcArg) || 'plus'"
/>
<FAIcon
v-else
class="focus-marker"
2025-01-13 22:32:39 +02:00
transform="shrink-6 up-9 right-15"
2025-01-12 18:49:44 +02:00
:icon="button.closeIndicator?.(funcArg) || 'minus'"
/>
</template>
</FALayers>
<span
v-if="extra"
class="action-label"
>
{{ $t(button.label(funcArg)) }}
</span>
<span
v-if="!extra && button.counter?.(funcArg) > 0"
class="action-counter"
>
{{ button.counter?.(funcArg) }}
</span>
2025-01-12 18:49:44 +02:00
<FAIcon
v-if="button.dropdown?.()"
2025-01-12 18:49:44 +02:00
class="chevron-icon"
size="lg"
:icon="extra ? 'chevron-right' : 'chevron-up'"
2025-01-12 22:32:30 +02:00
fixed-width
2025-01-12 18:49:44 +02:00
/>
</component>
<Popover
trigger="hover"
:placement="extra ? 'right' : 'top'"
:trigger-attrs="{ class: 'extra-button' }"
v-if="button.name === 'bookmark'"
>
<template #trigger>
<FAIcon
class="chevron-icon"
size="lg"
:icon="extra ? 'chevron-right' : 'chevron-up'"
fixed-width
/>
</template>
<template #content>
2025-01-14 09:59:03 +02:00
<StatusBookmarkFolderMenu v-if="button.name === 'bookmark'" :status="status" />
</template>
</Popover>
2025-01-12 18:49:44 +02:00
</div>
</template>
<script src="./action_button.js"/>
2025-01-13 22:32:39 +02:00
<style lang="scss" src="./action_button.scss"/>