elk/components/status/StatusActionButton.vue

37 lines
965 B
Vue
Raw Normal View History

2022-11-24 05:04:20 +00:00
<script setup lang="ts">
defineProps<{
text?: string | number
2022-11-27 15:11:34 +00:00
content: string
2022-11-24 05:04:20 +00:00
color: string
icon: string
2022-11-24 08:34:05 +00:00
activeIcon?: string
2022-11-24 05:04:20 +00:00
hover: string
groupHover: string
active?: boolean
disabled?: boolean
2022-11-25 23:46:25 +00:00
as?: string
2022-11-24 05:04:20 +00:00
}>()
defineOptions({
inheritAttrs: false,
})
</script>
<template>
2022-11-25 23:46:25 +00:00
<component
2022-11-27 15:11:34 +00:00
:is="as || 'button'" w-fit
2022-11-25 23:46:25 +00:00
flex gap-1 items-center rounded group
2022-11-27 15:11:34 +00:00
:hover="hover" focus:outline-none :focus-visible="hover"
:class="active ? [color] : 'text-secondary'"
2022-11-24 08:34:05 +00:00
v-bind="$attrs"
>
2022-11-27 15:11:34 +00:00
<CommonTooltip placement="bottom" :content="content">
<div rounded-full p2 :group-hover="groupHover" :group-focus-visible="groupHover" group-focus-visible:ring="2 current">
<div :class="[active && activeIcon ? activeIcon : icon, { 'pointer-events-none': disabled }]" />
</div>
</CommonTooltip>
2022-11-24 05:04:20 +00:00
2022-11-27 15:11:34 +00:00
<span v-if="text" :class="active ? [color] : 'text-secondary-light'" text-sm>{{ text }}</span>
2022-11-25 23:46:25 +00:00
</component>
2022-11-24 05:04:20 +00:00
</template>