parent
b3256099e7
commit
835ffd6c75
1 changed files with 0 additions and 37 deletions
@ -1,37 +0,0 @@ |
||||
import { useCopyText } from '../hooks/use-copy-text'; |
||||
import CopyIcon from '../icons/copy.svg'; |
||||
|
||||
type EditorProps = { |
||||
title: string; |
||||
text: string; |
||||
}; |
||||
|
||||
export function Editor(props: EditorProps) { |
||||
const { text, title } = props; |
||||
const { isCopied, copyText } = useCopyText(); |
||||
|
||||
return ( |
||||
<div className="flex flex-grow flex-col overflow-hidden rounded border border-gray-300 bg-gray-50"> |
||||
<div className="flex items-center justify-between gap-2 border-b border-gray-300 px-3 py-2"> |
||||
<span className="text-xs uppercase leading-none text-gray-400"> |
||||
{title} |
||||
</span> |
||||
<button className="flex items-center" onClick={() => copyText(text)}> |
||||
{isCopied && ( |
||||
<span className="mr-1 text-xs leading-none text-green-500"> |
||||
Copied! |
||||
</span> |
||||
)} |
||||
|
||||
<img src={CopyIcon} alt="Copy" className="inline-block h-4 w-4" /> |
||||
</button> |
||||
</div> |
||||
<textarea |
||||
className="no-scrollbar block h-11 w-full overflow-x-auto whitespace-nowrap bg-gray-200/70 p-3 text-sm text-gray-900" |
||||
readOnly |
||||
> |
||||
{text} |
||||
</textarea> |
||||
</div> |
||||
); |
||||
} |
Loading…
Reference in new issue