diff --git a/src/domain/photo/RegisterPhoto/ScanQRCode.tsx b/src/domain/photo/RegisterPhoto/ScanQRCode.tsx
index 49271b3..166d1b0 100644
--- a/src/domain/photo/RegisterPhoto/ScanQRCode.tsx
+++ b/src/domain/photo/RegisterPhoto/ScanQRCode.tsx
@@ -3,7 +3,23 @@ import { Html5QrcodeScanner } from 'html5-qrcode';
import { useEffect, useState } from 'react';
export default function ScanQRCode() {
- const [scanResult, setScanResult] = useState('');
+ const [scanResultUrl, setscanResultUrl] = useState('');
+
+ const isImgUrl = async (url: string) => {
+ console.log(url);
+
+ const img = new Image();
+ img.src = `${url}.png`;
+
+ return await new Promise((resolve) => {
+ img.onerror = () => {
+ resolve(false);
+ };
+ img.onload = () => {
+ resolve(true);
+ };
+ });
+ };
useEffect(() => {
const scanner = new Html5QrcodeScanner(
@@ -19,7 +35,7 @@ export default function ScanQRCode() {
);
const qrSuccessCallback = (decodedText: any, decodedResult: any) => {
- setScanResult(String(decodedText));
+ setscanResultUrl(String(decodedText));
scanner.clear().catch((err) => {
console.log(err);
@@ -29,9 +45,29 @@ export default function ScanQRCode() {
const qrFailCallback = () => {};
scanner.render(qrSuccessCallback, qrFailCallback);
+
+ return () => {
+ scanner.clear().catch((error) => {
+ console.error('Failed to clear html5QrcodeScanner. ', error);
+ });
+ };
}, []);
+ useEffect(() => {
+ if (scanResultUrl) {
+ isImgUrl(scanResultUrl)
+ .then((result) => {
+ console.log(result);
+ })
+ .catch((err) => {
+ console.error(err);
+ });
+ }
+ }, [scanResultUrl]);
+
return (
- <>{scanResult ?
주소 이름은 {scanResult}입니다.
:
}>
+ <>
+
+ >
);
}
diff --git a/src/domain/photo/RegisterPhoto/index.tsx b/src/domain/photo/RegisterPhoto/index.tsx
index 1552afe..0375223 100644
--- a/src/domain/photo/RegisterPhoto/index.tsx
+++ b/src/domain/photo/RegisterPhoto/index.tsx
@@ -21,8 +21,7 @@ export default function RegisterPhoto() {
];
return (
-
- RegisterPhoto 페이지
+
QR 코드를 스캔하세여
diff --git a/src/domain/photo/UploadPhoto/components/AddPhotoIntoAlbum.tsx b/src/domain/photo/UploadPhoto/components/AddPhotoIntoAlbum.tsx
new file mode 100644
index 0000000..a422925
--- /dev/null
+++ b/src/domain/photo/UploadPhoto/components/AddPhotoIntoAlbum.tsx
@@ -0,0 +1,32 @@
+import { ReactComponent as ArrowDownIcon } from '@/assets/arrow-down.svg';
+import { IconButton } from '@/domain/_common/components';
+import { Dropdown } from '@/domain/_common/components/Dropdown';
+import Bubble from '@/domain/_common/components/NoticeBubble';
+
+const sampleAlbumInfo = { id: '이건 내 엘범이야', link: 'https://ifh.cc/g/ySOj5R.jpg' };
+
+export default function AddPhotoIntoAlbum() {
+ return (
+ <>
+
+
+
+
+
+ } className="py-1 text-lg" />
+
+
+ 앨범이름 1
+ 앨범이름 2
+ 앨범이름 3
+
+
+
앨범에 사진 추가
+
+
+
+
+
+ >
+ );
+}
diff --git a/src/domain/photo/UploadPhoto/components/SelectFrame.tsx b/src/domain/photo/UploadPhoto/components/SelectFrame.tsx
new file mode 100644
index 0000000..41a4802
--- /dev/null
+++ b/src/domain/photo/UploadPhoto/components/SelectFrame.tsx
@@ -0,0 +1,32 @@
+import { Checkbox } from '@/domain/_common/components';
+import { useForm } from '@/hooks';
+import { yupSchema } from '@/utils/validation';
+
+export default function SelectFrame() {
+ const { control } = useForm({
+ defaultValues: {
+ checkbox: '',
+ },
+ schema: {
+ checkbox: yupSchema.requiredString,
+ },
+ mode: 'onChange',
+ });
+
+ return (
+ <>
+ 프레임 선택
+
+ >
+ );
+}
diff --git a/src/domain/photo/UploadPhoto/components/UploadInfo.tsx b/src/domain/photo/UploadPhoto/components/UploadInfo.tsx
new file mode 100644
index 0000000..f4c5d82
--- /dev/null
+++ b/src/domain/photo/UploadPhoto/components/UploadInfo.tsx
@@ -0,0 +1,36 @@
+import { TextInput } from '@/domain/_common/components';
+import { useForm } from '@/hooks';
+import { yupSchema } from '@/utils/validation';
+
+export default function UploadInfo() {
+ const { control } = useForm({
+ defaultValues: {
+ value1: '',
+ },
+ schema: { value1: yupSchema.requiredNumber },
+ mode: 'onChange',
+ });
+
+ return (
+
+ -
+
+
+
+ -
+
+
+
+ -
+
+
+
+
+ );
+}
diff --git a/src/domain/photo/UploadPhoto/index.tsx b/src/domain/photo/UploadPhoto/index.tsx
new file mode 100644
index 0000000..1020ff2
--- /dev/null
+++ b/src/domain/photo/UploadPhoto/index.tsx
@@ -0,0 +1,42 @@
+import { useState } from 'react';
+
+import { Stepper } from '@/domain/_common/components';
+import { Button } from '@/domain/_common/components/Button';
+
+import AddPhotoIntoAlbum from './components/AddPhotoIntoAlbum';
+import SelectFrame from './components/SelectFrame';
+import UploadInfo from './components/UploadInfo';
+
+export default function UploadPhoto() {
+ const [step, setStep] = useState(1);
+
+ const handleStepForward = () => {
+ setStep((prev) => prev + 1);
+ };
+
+ const handleStepBackward = () => {
+ setStep((prev) => prev - 1);
+ };
+
+ return (
+
+
새 사진 등록
+
+ {step === 1 &&
}
+ {step === 2 &&
}
+ {step === 3 &&
}
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/routers/PhotoRouters.tsx b/src/routers/PhotoRouters.tsx
index 0177a74..270d210 100644
--- a/src/routers/PhotoRouters.tsx
+++ b/src/routers/PhotoRouters.tsx
@@ -2,12 +2,14 @@ import { Route, Routes } from 'react-router-dom';
import PhotoList from '@/domain/photo/PhotoList';
import RegisterPhoto from '@/domain/photo/RegisterPhoto';
+import UploadPhoto from '@/domain/photo/UploadPhoto';
function PhotoRouters() {
return (
} />
} />
+ } />
);
}
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 76a3e63..538a2d9 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -4,6 +4,9 @@ module.exports = {
content: ['./src/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {
+ heights: {
+ 'small-h-screen': '100svh',
+ },
colors: {
black: {
DEFAULT: '#000000',