feat(chat): 更新聊天组件,支持模板选择和更本地化的体验

This commit is contained in:
zyh
2024-10-19 02:02:39 +00:00
parent 753889851a
commit 19cf6debf8
6 changed files with 138 additions and 14 deletions

View File

@@ -0,0 +1,39 @@
import React from 'react';
import { classNames } from '~/utils/classNames';
interface SelectOption {
value: string;
label: string;
}
interface SelectProps {
options: SelectOption[];
value: string;
onChange: (value: string) => void;
className?: string;
placeholder?: string;
}
export const Select: React.FC<SelectProps> = ({ options, value, onChange, className, placeholder }) => {
return (
<select
value={value}
onChange={(e) => onChange(e.target.value)}
className={classNames(
'px-3 py-2 bg-bolt-elements-background-depth-1 border border-bolt-elements-borderColor rounded-md text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-borderColor focus:border-transparent',
className
)}
>
{placeholder && (
<option value="" disabled>
{placeholder}
</option>
)}
{options.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
);
};