qwen-code/packages/webui/example/ExampleComponent.tsx
yiliang114 71570540cc feat(webui): migrate icons, Tooltip, WaitingMessage from vscode-ide-companion
- Move icon components (FileIcons, EditIcons, NavigationIcons, StatusIcons,
  SpecialIcons, StopIcon) from vscode-ide-companion to webui package
- Migrate Tooltip component with CSS variable theming support
- Migrate WaitingMessage and InterruptedMessage components
- Enhance Button component with forwardRef, new variants (ghost, outline),
  loading state, and icon support
- Enhance Input component with forwardRef, error state, label, and helper text
- Update vscode-ide-companion to import components from @qwen-code/webui
- Remove replaced local components from vscode-ide-companion
- Add skipLibCheck to vscode-ide-companion tsconfig for type compatibility
2026-01-15 19:53:19 +08:00

84 lines
2.1 KiB
TypeScript

/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
// Example of how to use shared UI components
// This would typically be integrated into existing components
import React, { useState } from 'react';
import {
Button,
Input,
Message,
PermissionDrawer,
Tooltip,
} from '@qwen-code/webui';
const ExampleComponent: React.FC = () => {
const [inputValue, setInputValue] = useState('');
const [showPermissionDrawer, setShowPermissionDrawer] = useState(false);
const handleConfirmPermission = () => {
console.log('Permissions confirmed');
setShowPermissionDrawer(false);
};
return (
<div className="p-4">
<h2 className="text-lg font-bold mb-4">Shared Components Demo</h2>
{/* Example of using shared Button component */}
<div className="mb-4">
<Button
variant="primary"
size="md"
onClick={() => setShowPermissionDrawer(true)}
>
Show Permission Drawer
</Button>
</div>
{/* Example of using shared Input component */}
<div className="mb-4">
<Input
value={inputValue}
onChange={setInputValue}
placeholder="Type something..."
/>
</div>
{/* Example of using shared Message component */}
<div className="mb-4">
<Message
id="demo-message"
content="This is a shared message component"
sender="system"
timestamp={new Date()}
/>
</div>
{/* Example of using shared Tooltip component */}
<div className="mb-4">
<Tooltip content="This is a helpful tooltip" position="top">
<Button variant="secondary">Hover for tooltip</Button>
</Tooltip>
</div>
{/* Example of using shared PermissionDrawer component */}
<PermissionDrawer
isOpen={showPermissionDrawer}
onClose={() => setShowPermissionDrawer(false)}
onConfirm={handleConfirmPermission}
permissions={[
'Access browser history',
'Read current page',
'Capture screenshots',
]}
/>
</div>
);
};
export default ExampleComponent;