diff --git a/src/pages/tools/string/qr-generator/index.tsx b/src/pages/tools/string/qr-generator/index.tsx index 5c35f49..1572fd5 100644 --- a/src/pages/tools/string/qr-generator/index.tsx +++ b/src/pages/tools/string/qr-generator/index.tsx @@ -2,10 +2,9 @@ import React, { useState } from 'react'; import ToolTextInput from '@components/input/ToolTextInput'; -import ToolTextResult from '@components/result/ToolTextResult'; -import { ToolComponentProps } from '@tools/defineTool'; import ToolContent from '@components/ToolContent'; -import { generateQRCodeSVG } from './service'; +import QRCode from 'react-qr-code'; +import type { ToolComponentProps } from '@tools/defineTool'; const initialValues = {}; @@ -14,39 +13,32 @@ export default function QRGeneratorTool({ longDescription }: ToolComponentProps) { const [input, setInput] = useState(''); - const [result, setResult] = useState(''); - - const computeExternal = () => { - setResult(generateQRCodeSVG(input)); - }; return ( []} // QR은 옵션 없이 단순 입력 → 변환 - compute={computeExternal} + getGroups={() => []} + compute={() => {}} // 실제 계산 X, 바로 반영 input={input} setInput={setInput} inputComponent={ } resultComponent={ - +
+ +
} toolInfo={{ title: 'QR 코드 생성기란?', description: longDescription }} - exampleCards={[]} // 예시 생략 가능 + exampleCards={[]} /> ); } diff --git a/src/pages/tools/string/qr-generator/service.ts b/src/pages/tools/string/qr-generator/service.ts index 849916a..f238199 100644 --- a/src/pages/tools/string/qr-generator/service.ts +++ b/src/pages/tools/string/qr-generator/service.ts @@ -1,17 +1,3 @@ -import QRCode from 'qrcode'; - -/** - * 문자열을 QR 코드 SVG 문자열로 변환 - */ -export function generateQRCodeSVG(text: string): string { - let svg = ''; - QRCode.toString( - text || 'https://example.com', - { type: 'svg' }, - (err, out) => { - if (err) console.error(err); - else svg = out; - } - ); - return svg; -} +export const isValidQRCodeInput = (text: string): boolean => { + return typeof text === 'string' && text.trim().length > 0; +};