tweak darkmode for modal (#1797)
This commit is contained in:
@@ -45,7 +45,7 @@ export default function EnvVarsSection({
|
|||||||
value={envVar.key}
|
value={envVar.key}
|
||||||
onChange={(e) => onChange(index, 'key', e.target.value)}
|
onChange={(e) => onChange(index, 'key', e.target.value)}
|
||||||
placeholder="Variable name"
|
placeholder="Variable name"
|
||||||
className={`w-full bg-bgSubtle border-borderSubtle text-textStandard`}
|
className={`w-full border-borderSubtle text-textStandard`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
@@ -53,7 +53,7 @@ export default function EnvVarsSection({
|
|||||||
value={envVar.value}
|
value={envVar.value}
|
||||||
onChange={(e) => onChange(index, 'value', e.target.value)}
|
onChange={(e) => onChange(index, 'value', e.target.value)}
|
||||||
placeholder="Value"
|
placeholder="Value"
|
||||||
className={`w-full bg-bgSubtle border-borderSubtle text-textStandard`}
|
className={`w-full border-borderSubtle text-textStandard`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
@@ -80,7 +80,7 @@ export default function EnvVarsSection({
|
|||||||
<Button
|
<Button
|
||||||
onClick={onAdd}
|
onClick={onAdd}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="flex items-center justify-start gap-1 px-2 pr-4 text-s font-medium rounded-full dark:bg-slate-400 dark:text-gray-300 bg-gray-300 text-slate-400 dark:hover:bg-slate-300 hover:bg-gray-500 hover:text-white dark:hover:text-gray-900 transition-colors min-w-[60px] h-9"
|
className="flex items-center justify-start gap-1 px-2 pr-4 text-s font-medium rounded-full dark:bg-slate-400 dark:text-gray-300 bg-gray-300 dark:bg-slate text-slate-400 dark:hover:bg-slate-300 hover:bg-gray-500 hover:text-white dark:hover:text-gray-900 transition-colors min-w-[60px] h-9"
|
||||||
>
|
>
|
||||||
<Plus className="h-3 w-3" /> Add
|
<Plus className="h-3 w-3" /> Add
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { Input } from '../../../ui/input';
|
||||||
|
import Select from 'react-select';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
|
interface ExtensionInfoFieldsProps {
|
||||||
|
name: string;
|
||||||
|
type: 'stdio' | 'sse' | 'builtin';
|
||||||
|
onChange: (key: string, value: any) => void;
|
||||||
|
submitAttempted: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ExtensionInfoFields({
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
onChange,
|
||||||
|
submitAttempted,
|
||||||
|
}: ExtensionInfoFieldsProps) {
|
||||||
|
const isNameValid = () => {
|
||||||
|
return name.trim() !== '';
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex justify-between gap-4 mb-6">
|
||||||
|
<div className="flex-1">
|
||||||
|
<label className="text-sm font-medium mb-2 block text-textStandard">Extension Name</label>
|
||||||
|
<div className="relative">
|
||||||
|
<Input
|
||||||
|
value={name}
|
||||||
|
onChange={(e) => onChange('name', e.target.value)}
|
||||||
|
placeholder="Enter extension name..."
|
||||||
|
className={`${!submitAttempted || isNameValid() ? 'border-borderSubtle' : 'border-red-500'} text-textStandard focus:border-borderStandard`}
|
||||||
|
/>
|
||||||
|
{submitAttempted && !isNameValid() && (
|
||||||
|
<div className="absolute text-xs text-red-500 mt-1">Name is required</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* Type Dropdown */}
|
||||||
|
<div className="w-[200px]">
|
||||||
|
<label className="text-sm font-medium mb-2 block text-textStandard">Type</label>
|
||||||
|
<Select
|
||||||
|
value={{ value: type, label: type.toUpperCase() }}
|
||||||
|
onChange={(option: { value: string; label: string } | null) => {
|
||||||
|
if (option) {
|
||||||
|
onChange('type', option.value);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
options={[
|
||||||
|
{ value: 'stdio', label: 'Standard IO (STDIO)' },
|
||||||
|
{ value: 'sse', label: 'Security Service Edge (SSE)' },
|
||||||
|
]}
|
||||||
|
isSearchable={false}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import { ExtensionFormData } from '../utils';
|
|||||||
import EnvVarsSection from './EnvVarsSection';
|
import EnvVarsSection from './EnvVarsSection';
|
||||||
import ExtensionConfigFields from './ExtensionConfigFields';
|
import ExtensionConfigFields from './ExtensionConfigFields';
|
||||||
import { PlusIcon, Edit, Trash2, AlertTriangle } from 'lucide-react';
|
import { PlusIcon, Edit, Trash2, AlertTriangle } from 'lucide-react';
|
||||||
|
import ExtensionInfoFields from './ExtensionInfoFields';
|
||||||
|
|
||||||
interface ExtensionModalProps {
|
interface ExtensionModalProps {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -172,50 +173,18 @@ export default function ExtensionModal({
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{/* Form Fields */}
|
{/* Form Fields */}
|
||||||
{/* Name */}
|
{/* Name and Type */}
|
||||||
<div className="flex justify-between gap-4 mb-6">
|
<ExtensionInfoFields
|
||||||
<div className="flex-1">
|
name={formData.name}
|
||||||
<label className="text-sm font-medium mb-2 block text-textStandard">
|
type={formData.type}
|
||||||
Extension Name
|
onChange={(key, value) => setFormData({ ...formData, [key]: value })}
|
||||||
</label>
|
submitAttempted={submitAttempted}
|
||||||
<div className="relative">
|
/>
|
||||||
<Input
|
|
||||||
value={formData.name}
|
|
||||||
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
|
||||||
placeholder="Enter extension name..."
|
|
||||||
className={`${!submitAttempted || formData.name.trim() !== '' ? 'border-borderSubtle' : 'border-red-500'} text-textStandard focus:border-borderStandard`}
|
|
||||||
/>
|
|
||||||
{submitAttempted && !isNameValid() && (
|
|
||||||
<div className="absolute text-xs text-red-500 mt-1">Name is required</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/*Type Dropdown */}
|
|
||||||
<div className="w-[200px]">
|
|
||||||
<label className="text-sm font-medium mb-2 block text-textStandard">Type</label>
|
|
||||||
<Select
|
|
||||||
value={{ value: formData.type, label: formData.type.toUpperCase() }}
|
|
||||||
onChange={(option: { value: string; label: string } | null) =>
|
|
||||||
setFormData({
|
|
||||||
...formData,
|
|
||||||
type: (option?.value as 'stdio' | 'sse' | 'builtin') || 'stdio',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
options={[
|
|
||||||
{ value: 'stdio', label: 'Standard IO (STDIO)' },
|
|
||||||
{ value: 'sse', label: 'Security Service Edge (SSE)' },
|
|
||||||
]}
|
|
||||||
styles={createDarkSelectStyles('200px')}
|
|
||||||
theme={darkSelectTheme}
|
|
||||||
isSearchable={false}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Divider */}
|
{/* Divider */}
|
||||||
<hr className="border-t border-borderSubtle mb-6" />
|
<hr className="border-t border-borderSubtle mb-6" />
|
||||||
|
|
||||||
{/* Config Fields */}
|
{/* Command */}
|
||||||
<div className="mb-6">
|
<div className="mb-6">
|
||||||
<ExtensionConfigFields
|
<ExtensionConfigFields
|
||||||
type={formData.type}
|
type={formData.type}
|
||||||
|
|||||||
Reference in New Issue
Block a user