mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 01:09:46 +00:00
## Summary Replace all hardcoded `text-[10px]`, `text-[11px]`, and `font-size: 10px` with a new `text-2xs` Tailwind theme token (0.625rem / 10px). ## Changes - **What**: Add `--text-2xs` custom theme token to design system CSS and replace 14 hardcoded font-size occurrences across 12 files with `text-2xs`. ## Review Focus Consistent use of design tokens instead of arbitrary values for small font sizes. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10604-fix-replace-hardcoded-font-size-10px-11px-with-text-2xs-Tailwind-token-3306d73d365081dfa1ebdc278e0a20b7) by [Unito](https://www.unito.io) Co-authored-by: Amp <amp@ampcode.com>
126 lines
4.3 KiB
Vue
126 lines
4.3 KiB
Vue
<template>
|
|
<div
|
|
class="option-container flex w-full cursor-pointer items-center justify-between overflow-hidden"
|
|
>
|
|
<div class="flex flex-col gap-0.5 overflow-hidden">
|
|
<div class="text-foreground flex items-center gap-2 font-semibold">
|
|
<span v-if="isBookmarked && !hideBookmarkIcon">
|
|
<i class="pi pi-bookmark-fill mr-1 text-sm" />
|
|
</span>
|
|
<span v-html="highlightQuery(nodeDef.display_name, currentQuery)" />
|
|
<span v-if="showIdName"> </span>
|
|
<span
|
|
v-if="showIdName"
|
|
class="rounded-sm bg-secondary-background px-1.5 py-0.5 text-xs text-muted-foreground"
|
|
v-html="highlightQuery(nodeDef.name, currentQuery)"
|
|
/>
|
|
|
|
<NodePricingBadge :node-def="nodeDef" />
|
|
<NodeProviderBadge v-if="nodeDef.api_node" :node-def="nodeDef" />
|
|
</div>
|
|
<div
|
|
v-if="showDescription"
|
|
class="flex items-center gap-1 text-2xs text-muted-foreground"
|
|
>
|
|
<span
|
|
v-if="
|
|
showSourceBadge &&
|
|
nodeDef.nodeSource.type !== NodeSourceType.Core &&
|
|
nodeDef.nodeSource.type !== NodeSourceType.Unknown
|
|
"
|
|
class="border-border mr-0.5 inline-flex shrink-0 rounded-sm border bg-base-foreground/5 px-1.5 py-0.5 text-xs text-base-foreground/70"
|
|
>
|
|
{{ nodeDef.nodeSource.displayText }}
|
|
</span>
|
|
<TextTicker v-if="nodeDef.description">
|
|
{{ nodeDef.description }}
|
|
</TextTicker>
|
|
</div>
|
|
<div
|
|
v-else-if="showCategory"
|
|
class="option-category truncate text-sm font-light text-muted"
|
|
>
|
|
{{ nodeDef.category.replaceAll('/', ' > ') }}
|
|
</div>
|
|
</div>
|
|
<div v-if="!showDescription" class="flex items-center gap-1">
|
|
<span
|
|
v-if="nodeDef.deprecated"
|
|
class="rounded-sm bg-red-500/20 px-1.5 py-0.5 text-xs text-red-400"
|
|
>
|
|
{{ $t('g.deprecated') }}
|
|
</span>
|
|
<span
|
|
v-if="nodeDef.experimental"
|
|
class="rounded-sm bg-blue-500/20 px-1.5 py-0.5 text-xs text-blue-400"
|
|
>
|
|
{{ $t('g.experimental') }}
|
|
</span>
|
|
<span
|
|
v-if="nodeDef.dev_only"
|
|
class="rounded-sm bg-cyan-500/20 px-1.5 py-0.5 text-xs text-cyan-400"
|
|
>
|
|
{{ $t('g.devOnly') }}
|
|
</span>
|
|
<span
|
|
v-if="showNodeFrequency && nodeFrequency > 0"
|
|
class="rounded-sm bg-secondary-background px-1.5 py-0.5 text-xs text-muted-foreground"
|
|
>
|
|
{{ formatNumberWithSuffix(nodeFrequency, { roundToInt: true }) }}
|
|
</span>
|
|
<span
|
|
v-if="nodeDef.nodeSource.type !== NodeSourceType.Unknown"
|
|
class="rounded-sm bg-secondary-background px-2 py-0.5 text-sm text-muted-foreground"
|
|
>
|
|
{{ nodeDef.nodeSource.displayText }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
|
|
import TextTicker from '@/components/common/TextTicker.vue'
|
|
import NodePricingBadge from '@/components/node/NodePricingBadge.vue'
|
|
import NodeProviderBadge from '@/components/node/NodeProviderBadge.vue'
|
|
import { useSettingStore } from '@/platform/settings/settingStore'
|
|
import { useNodeBookmarkStore } from '@/stores/nodeBookmarkStore'
|
|
import type { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
|
|
import { useNodeFrequencyStore } from '@/stores/nodeDefStore'
|
|
import { NodeSourceType } from '@/types/nodeSource'
|
|
import { formatNumberWithSuffix, highlightQuery } from '@/utils/formatUtil'
|
|
|
|
const {
|
|
nodeDef,
|
|
currentQuery,
|
|
showDescription = false,
|
|
showSourceBadge = false,
|
|
hideBookmarkIcon = false
|
|
} = defineProps<{
|
|
nodeDef: ComfyNodeDefImpl
|
|
currentQuery: string
|
|
showDescription?: boolean
|
|
showSourceBadge?: boolean
|
|
hideBookmarkIcon?: boolean
|
|
}>()
|
|
|
|
const settingStore = useSettingStore()
|
|
const showCategory = computed(() =>
|
|
settingStore.get('Comfy.NodeSearchBoxImpl.ShowCategory')
|
|
)
|
|
const showIdName = computed(() =>
|
|
settingStore.get('Comfy.NodeSearchBoxImpl.ShowIdName')
|
|
)
|
|
const showNodeFrequency = computed(() =>
|
|
settingStore.get('Comfy.NodeSearchBoxImpl.ShowNodeFrequency')
|
|
)
|
|
const nodeFrequencyStore = useNodeFrequencyStore()
|
|
const nodeFrequency = computed(() =>
|
|
nodeFrequencyStore.getNodeFrequency(nodeDef)
|
|
)
|
|
|
|
const nodeBookmarkStore = useNodeBookmarkStore()
|
|
const isBookmarked = computed(() => nodeBookmarkStore.isBookmarked(nodeDef))
|
|
</script>
|