mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
## Summary - replace raw button elements in queue progress overlay UI with shared IconButton/TextButton/IconTextButton components - remove forced justify-start from IconTextButton base and add explicit alignment where needed - keep queue overlay actions consistent with button styling patterns ## Testing - pnpm typecheck - pnpm lint:fix ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6793-Use-shared-button-components-in-queue-overlay-2b26d73d3650814d9ebfebba74226036) by [Unito](https://www.unito.io)
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>
|