diff --git a/packages/vscode-ide-companion/src/webview/components/PermissionDrawer.tailwind.tsx b/packages/vscode-ide-companion/src/webview/components/PermissionDrawer.tailwind.tsx new file mode 100644 index 00000000..621cf843 --- /dev/null +++ b/packages/vscode-ide-companion/src/webview/components/PermissionDrawer.tailwind.tsx @@ -0,0 +1,121 @@ +/** + * @license + * Copyright 2025 Qwen Team + * SPDX-License-Identifier: Apache-2.0 + * + * PermissionDrawer component using Tailwind CSS + */ + +import type React from 'react'; +import { useEffect } from 'react'; +import { + PermissionRequest, + type PermissionOption, + type ToolCall, +} from './PermissionRequest.js'; +import { buttonClasses, commonClasses } from '../../lib/tailwindUtils.js'; + +interface PermissionDrawerProps { + isOpen: boolean; + options: PermissionOption[]; + toolCall: ToolCall; + onResponse: (optionId: string) => void; + onClose?: () => void; +} + +/** + * Permission drawer component - displays permission requests in a bottom sheet + * Uses Tailwind CSS for styling + * @param isOpen - Whether the drawer is open + * @param options - Permission options to display + * @param toolCall - Tool call information + * @param onResponse - Callback when user responds + * @param onClose - Optional callback when drawer closes + */ +export const PermissionDrawerTailwind: React.FC = ({ + isOpen, + options, + toolCall, + onResponse, + onClose, +}) => { + // Close drawer on Escape key + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + if (!isOpen) { + return; + } + + // Close on Escape + if (e.key === 'Escape' && onClose) { + onClose(); + return; + } + + // Quick select with number keys (1-9) + const numMatch = e.key.match(/^[1-9]$/); + if (numMatch) { + const index = parseInt(e.key, 10) - 1; + if (index < options.length) { + e.preventDefault(); + onResponse(options[index].optionId); + } + } + }; + + window.addEventListener('keydown', handleKeyDown); + return () => window.removeEventListener('keydown', handleKeyDown); + }, [isOpen, onClose, options, onResponse]); + + if (!isOpen) { + return null; + } + + return ( + <> + {/* Backdrop */} +
+ + {/* Drawer */} +
+
+
+

Permission Required

+ {onClose && ( + + )} +
+ +
+ +
+
+ + ); +}; \ No newline at end of file diff --git a/packages/vscode-ide-companion/src/webview/components/TailwindDemo.tsx b/packages/vscode-ide-companion/src/webview/components/TailwindDemo.tsx new file mode 100644 index 00000000..519b3d8e --- /dev/null +++ b/packages/vscode-ide-companion/src/webview/components/TailwindDemo.tsx @@ -0,0 +1,111 @@ +/** + * @license + * Copyright 2025 Qwen Team + * SPDX-License-Identifier: Apache-2.0 + * + * Demo page showing how to use Tailwind components alongside existing CSS + * This demonstrates the progressive adoption approach + */ + +import type React from 'react'; +import { Button } from './ui/Button'; +import { Card } from './ui/Card'; + +/** + * Demo component showing how to use Tailwind components + * alongside existing CSS-based components + */ +export const TailwindDemo: React.FC = () => { + return ( +
+

+ Tailwind CSS Progressive Adoption Demo +

+ +

+ This page demonstrates how to gradually adopt Tailwind CSS in an existing project + while maintaining compatibility with existing CSS styles. +

+ + {/* Example 1: Using new Tailwind components */} + + +

New Components with Tailwind

+
+ +

+ These are new components built with Tailwind CSS: +

+
+ + + +
+
+
+ + {/* Example 2: Hybrid approach - mixing Tailwind with existing styles */} +
+

Hybrid Approach

+

+ This card uses existing CSS classes but enhances them with Tailwind utilities: +

+
+ + +
+
+ + {/* Example 3: Utility-first approach */} +
+

Utility-First Approach

+

+ This section uses Tailwind's utility-first approach: +

+
+
+

Feature 1

+

+ Description of feature 1 +

+
+
+

Feature 2

+

+ Description of feature 2 +

+
+
+

Feature 3

+

+ Description of feature 3 +

+
+
+
+ + {/* Example 4: Responsive design */} +
+

Responsive Design

+

+ Tailwind makes responsive design easy with breakpoint prefixes: +

+
+
+

Column 1

+
+
+

Column 2

+
+
+

Column 3

+
+
+
+
+ ); +}; \ No newline at end of file