feat: import from file button 삭제

This commit is contained in:
minseonju 2025-05-21 20:32:38 +09:00
commit 51f8cdaba8
3 changed files with 19 additions and 6 deletions

View file

@ -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

View file

@ -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="*"

View file

@ -41,6 +41,7 @@ export default function QRGeneratorTool({
title="QR 코드에 들어갈 텍스트"
value={input}
onChange={setInput}
hideFileImport
/>
}
resultComponent={