import React, { useState } from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { CodeEditor, type CodeEditorProps } from '../../src/ui/CodeEditor/CodeEditor'; // Monaco is loaded from a CDN at runtime, so these stories only check that the // editor mounts; they have no interaction tests. function ControlledEditor( props: Omit & { initial: string }, ) { const { initial, ...rest } = props; const [value, setValue] = useState(initial); return ; } const meta: Meta = { title: 'UI/CodeEditor', component: ControlledEditor, parameters: { layout: 'padded' }, tags: ['autodocs'], }; export default meta; type Story = StoryObj; export const JavaScript: Story = { args: { language: 'javascript', rows: 8, initial: "await context.page.goto(context.getEnv('BASE_URL'));\nreturn await context.page.title();", }, }; export const WithError: Story = { args: { language: 'javascript', rows: 4, error: true, initial: 'await context.page.goto(' }, };