mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-28 02:34:10 +00:00
Backport of #6793 to `cloud/1.32` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6855-backport-cloud-1-32-Use-shared-button-components-in-queue-overlay-2b46d73d365081d69a6edd5e08e19edd) by [Unito](https://www.unito.io) Co-authored-by: Benjamin Lu <benceruleanlu@proton.me>
59 lines
1.3 KiB
Vue
59 lines
1.3 KiB
Vue
<template>
|
|
<Button
|
|
v-bind="$attrs"
|
|
unstyled
|
|
:class="buttonStyle"
|
|
:disabled="disabled"
|
|
@click="onClick"
|
|
>
|
|
<slot v-if="iconPosition !== 'right'" name="icon"></slot>
|
|
<span>{{ label }}</span>
|
|
<slot v-if="iconPosition === 'right'" name="icon"></slot>
|
|
</Button>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Button from 'primevue/button'
|
|
import { computed } from 'vue'
|
|
|
|
import type { BaseButtonProps } from '@/types/buttonTypes'
|
|
import {
|
|
getBaseButtonClasses,
|
|
getBorderButtonTypeClasses,
|
|
getButtonSizeClasses,
|
|
getButtonTypeClasses
|
|
} from '@/types/buttonTypes'
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
defineOptions({
|
|
inheritAttrs: false
|
|
})
|
|
|
|
interface IconTextButtonProps extends BaseButtonProps {
|
|
iconPosition?: 'left' | 'right'
|
|
label: string
|
|
onClick?: () => void
|
|
}
|
|
|
|
const {
|
|
size = 'md',
|
|
type = 'primary',
|
|
border = false,
|
|
disabled = false,
|
|
class: className,
|
|
iconPosition = 'left',
|
|
label,
|
|
onClick
|
|
} = defineProps<IconTextButtonProps>()
|
|
|
|
const buttonStyle = computed(() => {
|
|
const baseClasses = `${getBaseButtonClasses()} justify-start gap-2`
|
|
const sizeClasses = getButtonSizeClasses(size)
|
|
const typeClasses = border
|
|
? getBorderButtonTypeClasses(type)
|
|
: getButtonTypeClasses(type)
|
|
|
|
return cn(baseClasses, sizeClasses, typeClasses, className)
|
|
})
|
|
</script>
|