Skip to content

Commit 73e4ae2

Browse files
refactor: replace raw buttons with Button component in WidgetActions (#8973)
Fixes #8889 Replaces custom-styled `<button>` elements in WidgetActions.vue with the shared Button component for better consistency with the design system. Uses `variant="textonly"` with `size="unset"` to match the existing dropdown menu item styling. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8973-refactor-replace-raw-buttons-with-Button-component-in-WidgetActions-30c6d73d36508194beb2f5d810dde382) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <drjkl@comfy.org>
1 parent f5c9c72 commit 73e4ae2

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

src/components/rightSidePanel/parameters/WidgetActions.vue

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<script setup lang="ts">
2-
import { cn } from '@comfyorg/tailwind-utils'
32
import { isEqual } from 'es-toolkit'
43
import { computed } from 'vue'
54
import { useI18n } from 'vue-i18n'
65
76
import MoreButton from '@/components/button/MoreButton.vue'
7+
import Button from '@/components/ui/button/Button.vue'
88
import { isProxyWidget } from '@/core/graph/subgraph/proxyWidget'
99
import {
1010
demoteWidget,
@@ -123,12 +123,6 @@ function handleResetToDefault() {
123123
if (!hasDefault.value) return
124124
emit('resetToDefault', defaultValue.value)
125125
}
126-
127-
const buttonClasses = cn([
128-
'border-none bg-transparent',
129-
'w-full flex items-center gap-2 rounded px-3 py-2 text-sm',
130-
'cursor-pointer transition-all hover:bg-secondary-background-hover active:scale-95'
131-
])
132126
</script>
133127

134128
<template>
@@ -137,8 +131,10 @@ const buttonClasses = cn([
137131
class="text-muted-foreground bg-transparent hover:text-base-foreground hover:bg-secondary-background-hover active:scale-95 transition-all"
138132
>
139133
<template #default="{ close }">
140-
<button
141-
:class="buttonClasses"
134+
<Button
135+
variant="textonly"
136+
size="unset"
137+
class="w-full flex items-center gap-2 rounded px-3 py-2 text-sm transition-all active:scale-95"
142138
@click="
143139
() => {
144140
handleRename()
@@ -148,11 +144,13 @@ const buttonClasses = cn([
148144
>
149145
<i class="icon-[lucide--edit] size-4" />
150146
<span>{{ t('g.rename') }}</span>
151-
</button>
147+
</Button>
152148

153-
<button
149+
<Button
154150
v-if="hasParents"
155-
:class="buttonClasses"
151+
variant="textonly"
152+
size="unset"
153+
class="w-full flex items-center gap-2 rounded px-3 py-2 text-sm transition-all active:scale-95"
156154
@click="
157155
() => {
158156
if (isShownOnParents) handleHideInput()
@@ -169,10 +167,12 @@ const buttonClasses = cn([
169167
<i class="icon-[lucide--eye] size-4" />
170168
<span>{{ t('rightSidePanel.showInput') }}</span>
171169
</template>
172-
</button>
170+
</Button>
173171

174-
<button
175-
:class="buttonClasses"
172+
<Button
173+
variant="textonly"
174+
size="unset"
175+
class="w-full flex items-center gap-2 rounded px-3 py-2 text-sm transition-all active:scale-95"
176176
@click="
177177
() => {
178178
handleToggleFavorite()
@@ -181,18 +181,20 @@ const buttonClasses = cn([
181181
"
182182
>
183183
<template v-if="isFavorited">
184-
<i class="icon-[lucide--star]" />
184+
<i class="icon-[lucide--star] size-4" />
185185
<span>{{ t('rightSidePanel.removeFavorite') }}</span>
186186
</template>
187187
<template v-else>
188-
<i class="icon-[lucide--star]" />
188+
<i class="icon-[lucide--star] size-4" />
189189
<span>{{ t('rightSidePanel.addFavorite') }}</span>
190190
</template>
191-
</button>
191+
</Button>
192192

193-
<button
193+
<Button
194194
v-if="hasDefault"
195-
:class="cn(buttonClasses, isCurrentValueDefault && 'opacity-50')"
195+
variant="textonly"
196+
size="unset"
197+
class="w-full flex items-center gap-2 rounded px-3 py-2 text-sm transition-all active:scale-95"
196198
:disabled="isCurrentValueDefault"
197199
@click="
198200
() => {
@@ -203,7 +205,7 @@ const buttonClasses = cn([
203205
>
204206
<i class="icon-[lucide--rotate-ccw] size-4" />
205207
<span>{{ t('rightSidePanel.resetToDefault') }}</span>
206-
</button>
208+
</Button>
207209
</template>
208210
</MoreButton>
209211
</template>

0 commit comments

Comments
 (0)