test: 暂存

This commit is contained in:
2024-09-18 04:17:11 +08:00
parent a36a390d25
commit b838488776
19 changed files with 683 additions and 142 deletions

View File

@@ -4,7 +4,7 @@ import { clsx } from 'clsx';
type Props = {
value?: string;
onChange?: (evn: React.ChangeEvent<HTMLTextAreaElement>) => void;
onChange?: (data: string) => void;
readonly?: boolean;
className?: string;
};
@@ -13,14 +13,19 @@ export const TextArea = (props: Props) => {
useEffect(() => {
setCode(props.value || '');
}, []);
const _onChange = (value: string) => {
setCode(value);
props.onChange && props.onChange(value);
};
return (
<div className={clsx('min-h-16 max-h-52 overflow-scroll p-1')}>
<div className={clsx('min-h-16 max-h-52 overflow-scroll p-1 ', props.className)}>
<CodeEditor
value={code}
language='js'
className='border rounded-sm'
readOnly={props.readonly}
placeholder='Please enter JS code.'
onChange={(evn) => setCode(evn.target.value)}
onChange={(evn) => _onChange(evn.target.value)}
padding={10}
style={{
backgroundColor: '#f5f5f5',