refactor: update imports and button event handlers in story files

- Refactored import statements in CodeEditor, ThinkingEffect, ErrorBoundary, and Spinner story files for consistency and clarity.
- Changed button event handlers from `onPress` to `onClick` to align with standard React practices.
- Improved type imports for better organization and maintainability.
This commit is contained in:
MyPrototypeWhat 2025-11-03 19:17:50 +08:00
parent 292f7f7b75
commit 4ef4297391
4 changed files with 11 additions and 11 deletions

View File

@ -1,8 +1,8 @@
import type { Meta, StoryObj } from '@storybook/react-vite'
import { action } from 'storybook/actions'
import type { LanguageConfig } from '../../../src/components'
import CodeEditor, { getCmThemeByName, getCmThemeNames } from '../../../src/components'
import { CodeEditor, getCmThemeByName, getCmThemeNames } from '../../../src/components'
import type { LanguageConfig } from '../../../src/components/composites/CodeEditor/types'
// 示例语言配置 - 为 Storybook 提供更丰富的语言支持演示
const exampleLanguageConfig: LanguageConfig = {

View File

@ -1,7 +1,7 @@
import { Button } from '../../../src/components'
import type { Meta, StoryObj } from '@storybook/react'
import { useEffect, useMemo, useState } from 'react'
import { Button } from '../../../src/components'
import { ThinkingEffect } from '../../../src/components'
const meta: Meta<typeof ThinkingEffect> = {

View File

@ -1,8 +1,8 @@
import { Button } from '../../../src/components'
import type { Meta, StoryObj } from '@storybook/react'
import { useState } from 'react'
import type { CustomFallbackProps } from '../../../src/components'
import { Button } from '../../../src/components'
import { ErrorBoundary } from '../../../src/components'
// 错误组件 - 用于触发错误
@ -30,7 +30,7 @@ const AsyncErrorComponent = () => {
return (
<div className="p-4 space-y-2">
<p></p>
<Button onPress={handleAsyncError}>1</Button>
<Button onClick={handleAsyncError}>1</Button>
</div>
)
}
@ -138,7 +138,7 @@ export const InteractiveDemo: Story = {
return (
<div className="space-y-4">
<div className="flex gap-2">
<Button color={shouldThrow ? 'danger' : 'primary'} onPress={() => setShouldThrow(!shouldThrow)}>
<Button variant={shouldThrow ? 'destructive' : 'default'} onClick={() => setShouldThrow(!shouldThrow)}>
{shouldThrow ? '取消错误' : '触发错误'}
</Button>
<input
@ -174,12 +174,12 @@ export const CustomFallback: Story = {
<p className="text-sm opacity-90 mb-4">{error?.message}</p>
<div className="flex gap-2 justify-center">
{onDebugClick && (
<Button size="sm" variant="flat" onPress={onDebugClick}>
<Button size="sm" variant="outline" onClick={onDebugClick}>
</Button>
)}
{onReloadClick && (
<Button size="sm" variant="flat" onPress={onReloadClick}>
<Button size="sm" variant="outline" onClick={onReloadClick}>
</Button>
)}

View File

@ -1,7 +1,7 @@
import { Button } from '../../../src/components'
import type { Meta, StoryObj } from '@storybook/react'
import { useState } from 'react'
import { Button } from '../../../src/components'
import { Spinner } from '../../../src/components'
const meta: Meta<typeof Spinner> = {
@ -108,7 +108,7 @@ export const InteractiveDemo: Story = {
return (
<div className="space-y-4">
<div className="flex gap-2">
<Button onPress={handleStartLoading} disabled={isLoading} color="primary">
<Button onClick={handleStartLoading} disabled={isLoading}>
{isLoading ? '正在处理...' : '开始加载'}
</Button>
<input
@ -269,7 +269,7 @@ export const LoadingSequence: Story = {
return (
<div className="space-y-4">
<Button onPress={nextStep}>{isComplete ? '重新开始' : '下一步'}</Button>
<Button onClick={nextStep}>{isComplete ? '重新开始' : '下一步'}</Button>
<div className="p-6 border border-gray-200 dark:border-gray-700 rounded-lg">
{isComplete ? (