mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-19 06:20:10 +00:00
## Summary Only remaining use is in `buttonTypes.ts` which @viva-jinyi is going to be working on to consolidate our different buttons soon. ## Changes - **What**: Replace light/dark colors with theme aware design system tokens. ## Review Focus Double check the chosen colors for the components ## Screenshots | Before | After | | ------ | ----- | | <img width="607" height="432" alt="image" src="https://github.com/user-attachments/assets/6c0ee6d6-819f-40b1-b775-f8b25dd18104" /> | <img width="646" height="488" alt="image" src="https://github.com/user-attachments/assets/9c8532de-8ac6-4b48-9021-3fd0b3e0bc63" /> | ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6705-Style-WIP-Design-System-use-across-more-components-2ab6d73d365081619115fc5f87a46341) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
178 lines
4.4 KiB
TypeScript
178 lines
4.4 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/vue3-vite'
|
|
|
|
import AssetBrowserModal from '@/platform/assets/components/AssetBrowserModal.vue'
|
|
import type { AssetDisplayItem } from '@/platform/assets/composables/useAssetBrowser'
|
|
import {
|
|
createMockAssets,
|
|
mockAssets
|
|
} from '@/platform/assets/fixtures/ui-mock-assets'
|
|
|
|
// Story arguments interface
|
|
interface StoryArgs {
|
|
nodeType: string
|
|
inputName: string
|
|
currentValue: string
|
|
showLeftPanel?: boolean
|
|
}
|
|
|
|
const meta: Meta<StoryArgs> = {
|
|
title: 'Platform/Assets/AssetBrowserModal',
|
|
component: AssetBrowserModal,
|
|
parameters: {
|
|
layout: 'fullscreen'
|
|
},
|
|
argTypes: {
|
|
nodeType: {
|
|
control: 'select',
|
|
options: ['CheckpointLoaderSimple', 'VAELoader', 'ControlNetLoader'],
|
|
description: 'ComfyUI node type for context'
|
|
},
|
|
inputName: {
|
|
control: 'select',
|
|
options: ['ckpt_name', 'vae_name', 'control_net_name'],
|
|
description: 'Widget input name'
|
|
},
|
|
currentValue: {
|
|
control: 'text',
|
|
description: 'Current selected asset value'
|
|
},
|
|
showLeftPanel: {
|
|
control: 'boolean',
|
|
description: 'Whether to show the left panel with categories'
|
|
}
|
|
}
|
|
}
|
|
|
|
export default meta
|
|
type Story = StoryObj<typeof meta>
|
|
|
|
// Modal Layout Stories
|
|
export const Default: Story = {
|
|
args: {
|
|
nodeType: 'CheckpointLoaderSimple',
|
|
inputName: 'ckpt_name',
|
|
currentValue: '',
|
|
showLeftPanel: true
|
|
},
|
|
render: (args) => ({
|
|
components: { AssetBrowserModal },
|
|
setup() {
|
|
const onAssetSelect = (_asset: AssetDisplayItem) => {
|
|
// Asset selection handler for story
|
|
}
|
|
const onClose = () => {}
|
|
|
|
return {
|
|
...args,
|
|
onAssetSelect,
|
|
onClose,
|
|
assets: mockAssets
|
|
}
|
|
},
|
|
template: `
|
|
<div class="flex items-center justify-center min-h-screen bg-ash-800 p-4">
|
|
<AssetBrowserModal
|
|
:node-type="nodeType"
|
|
:input-name="inputName"
|
|
:show-left-panel="showLeftPanel"
|
|
:assets="assets"
|
|
@asset-select="onAssetSelect"
|
|
@close="onClose"
|
|
/>
|
|
</div>
|
|
`
|
|
})
|
|
}
|
|
|
|
// Story demonstrating single asset type (auto-hides left panel)
|
|
export const SingleAssetType: Story = {
|
|
args: {
|
|
nodeType: 'CheckpointLoaderSimple',
|
|
inputName: 'ckpt_name',
|
|
currentValue: '',
|
|
showLeftPanel: false
|
|
},
|
|
render: (args) => ({
|
|
components: { AssetBrowserModal },
|
|
setup() {
|
|
const onAssetSelect = (_asset: AssetDisplayItem) => {
|
|
// Asset selection handler for story
|
|
}
|
|
const onClose = () => {
|
|
// Modal close handler for story
|
|
}
|
|
|
|
// Create assets with only one type (checkpoints)
|
|
const singleTypeAssets = createMockAssets(15).map((asset) => ({
|
|
...asset,
|
|
type: 'checkpoint'
|
|
}))
|
|
|
|
return { ...args, onAssetSelect, onClose, assets: singleTypeAssets }
|
|
},
|
|
template: `
|
|
<div class="flex items-center justify-center min-h-screen bg-ash-800 p-4">
|
|
<AssetBrowserModal
|
|
:node-type="nodeType"
|
|
:input-name="inputName"
|
|
:show-left-panel="showLeftPanel"
|
|
:assets="assets"
|
|
@asset-select="onAssetSelect"
|
|
@close="onClose"
|
|
/>
|
|
</div>
|
|
`
|
|
}),
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
story:
|
|
'Modal with assets of only one type (checkpoint) - left panel auto-hidden.'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Story with left panel explicitly hidden
|
|
export const NoLeftPanel: Story = {
|
|
args: {
|
|
nodeType: 'CheckpointLoaderSimple',
|
|
inputName: 'ckpt_name',
|
|
currentValue: '',
|
|
showLeftPanel: false
|
|
},
|
|
render: (args) => ({
|
|
components: { AssetBrowserModal },
|
|
setup() {
|
|
const onAssetSelect = (_asset: AssetDisplayItem) => {
|
|
// Asset selection handler for story
|
|
}
|
|
const onClose = () => {
|
|
// Modal close handler for story
|
|
}
|
|
|
|
return { ...args, onAssetSelect, onClose, assets: mockAssets }
|
|
},
|
|
template: `
|
|
<div class="flex items-center justify-center min-h-screen bg-ash-800 p-4">
|
|
<AssetBrowserModal
|
|
:node-type="nodeType"
|
|
:input-name="inputName"
|
|
:show-left-panel="showLeftPanel"
|
|
:assets="assets"
|
|
@asset-select="onAssetSelect"
|
|
@close="onClose"
|
|
/>
|
|
</div>
|
|
`
|
|
}),
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
story:
|
|
'Modal with left panel explicitly disabled via showLeftPanel=false.'
|
|
}
|
|
}
|
|
}
|
|
}
|