mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-11-05 16:34:57 +05:30
feat: import from file button 삭제
This commit is contained in:
parent
9760bdf159
commit
51f8cdaba8
3 changed files with 19 additions and 6 deletions
|
|
@ -9,15 +9,18 @@ export default function InputFooter({
|
|||
handleCopy,
|
||||
handleClear
|
||||
}: {
|
||||
handleImport: () => void;
|
||||
handleImport?: () => void;
|
||||
handleCopy?: () => void;
|
||||
handleClear?: () => void;
|
||||
}) {
|
||||
return (
|
||||
<Stack mt={1} direction={'row'} spacing={2}>
|
||||
<Button onClick={handleImport} startIcon={<PublishIcon />}>
|
||||
Import from file
|
||||
</Button>
|
||||
{handleImport && (
|
||||
<Button onClick={handleImport} startIcon={<PublishIcon />}>
|
||||
Import from file
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{handleCopy && (
|
||||
<Button onClick={handleCopy} startIcon={<ContentPasteIcon />}>
|
||||
Copy to clipboard
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import InputFooter from './InputFooter';
|
|||
export default function ToolTextInput({
|
||||
value,
|
||||
onChange,
|
||||
title = 'Input text'
|
||||
title = 'Input text',
|
||||
hideFileImport = false
|
||||
}: {
|
||||
title?: string;
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
hideFileImport?: boolean;
|
||||
}) {
|
||||
const { showSnackBar } = useContext(CustomSnackBarContext);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
|
@ -24,6 +26,7 @@ export default function ToolTextInput({
|
|||
showSnackBar('Failed to copy: ' + err, 'error');
|
||||
});
|
||||
};
|
||||
|
||||
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = event.target.files?.[0];
|
||||
if (file) {
|
||||
|
|
@ -41,6 +44,7 @@ export default function ToolTextInput({
|
|||
const handleImportClick = () => {
|
||||
fileInputRef.current?.click();
|
||||
};
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<InputHeader title={title} />
|
||||
|
|
@ -59,7 +63,12 @@ export default function ToolTextInput({
|
|||
'data-testid': 'text-input'
|
||||
}}
|
||||
/>
|
||||
<InputFooter handleCopy={handleCopy} handleImport={handleImportClick} />
|
||||
|
||||
<InputFooter
|
||||
handleCopy={handleCopy}
|
||||
handleImport={hideFileImport ? undefined : handleImportClick}
|
||||
/>
|
||||
|
||||
<input
|
||||
type="file"
|
||||
accept="*"
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export default function QRGeneratorTool({
|
|||
title="QR 코드에 들어갈 텍스트"
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
hideFileImport
|
||||
/>
|
||||
}
|
||||
resultComponent={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue