feat: 添加container列表
This commit is contained in:
32
src/pages/container/components/TextArea.tsx
Normal file
32
src/pages/container/components/TextArea.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import CodeEditor from '@uiw/react-textarea-code-editor';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
|
||||
type Props = {
|
||||
value?: string;
|
||||
onChange?: (evn: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
||||
readonly?: boolean;
|
||||
className?: string;
|
||||
};
|
||||
export const TextArea = (props: Props) => {
|
||||
const [code, setCode] = useState<string>('');
|
||||
useEffect(() => {
|
||||
setCode(props.value || '');
|
||||
}, []);
|
||||
return (
|
||||
<div className={clsx('min-h-16 max-h-52 overflow-scroll p-1')}>
|
||||
<CodeEditor
|
||||
value={code}
|
||||
language='js'
|
||||
readOnly={props.readonly}
|
||||
placeholder='Please enter JS code.'
|
||||
onChange={(evn) => setCode(evn.target.value)}
|
||||
padding={10}
|
||||
style={{
|
||||
backgroundColor: '#f5f5f5',
|
||||
fontFamily: 'ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user