-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from HaruDamda/test/테스트용-브랜치
#10 feat: 포토북 기능 완전구현, 기타 에러 수정
- Loading branch information
Showing
11 changed files
with
599 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
import axios from "axios"; | ||
|
||
export const emailCheck = (formData, setFormData) => { | ||
|
||
axios | ||
.post(`http://ec2-3-35-208-177.ap-northeast-2.compute.amazonaws.com:8080/v2/api-docs/user/${formData.email}`) | ||
.then(() => { | ||
export const emailCheck = async (formData, setFormData) => { | ||
try { | ||
// 서버에 이메일 중복 체크 요청 | ||
const response = await axios.post(`http://ec2-3-35-208-177.ap-northeast-2.compute.amazonaws.com:8080/user/${formData.email}`); | ||
|
||
// 응답이 200이면 이메일 중복 없음 | ||
if (response.status === 200) { | ||
alert("사용할 수 있는 이메일입니다."); | ||
}) | ||
.catch(() => { | ||
} else { | ||
// 다른 상태 코드가 반환된 경우 | ||
alert("사용할 수 없는 이메일입니다."); | ||
setFormData({ ...formData, email: "" }); | ||
}); | ||
} | ||
} catch (error) { | ||
// 오류가 발생한 경우 (401 등) | ||
alert("오류가 발생했습니다. 다시 시도해주세요."); | ||
console.error(error); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// import { useRef } from 'react'; | ||
// import { useDrag } from 'react-use-gesture'; | ||
// import memopic1 from "../../img/memopic1.png"; | ||
|
||
// import styles from './Example.module.scss'; | ||
|
||
// export default function App() { | ||
// const domTarget = useRef(null); | ||
|
||
// const bind = useDrag(({ offset: [dx, dy] }) => { | ||
// // 특정 범위 내에서만 드래그 허용 | ||
// const newX = Math.min(Math.max(dx, -100), 100); | ||
// const newY = Math.min(Math.max(dy, -100), 100); | ||
|
||
// domTarget.current.style.transform = `translate3d(${newX}px, ${newY}px, 0)`; | ||
// }); | ||
|
||
// return ( | ||
// <div className={styles.container}> | ||
// <img | ||
// ref={domTarget} | ||
// className={styles.card} | ||
// style={{ | ||
// transform: 'perspective(600px)', | ||
// }} | ||
// {...bind()} | ||
// src={memopic1} | ||
// alt="memopic" | ||
// /> | ||
// </div> | ||
// ); | ||
// } | ||
|
||
import { useState, useRef } from 'react'; | ||
import imageUrl from "../../img/memopic1.png"; | ||
|
||
const DraggableImage = () => { | ||
const [imagePosition, setImagePosition] = useState({ x: 0, y: 0 }); | ||
|
||
const handleImageDrag = (clientX, clientY) => { | ||
// Update the image position based on the drag | ||
setImagePosition({ x: clientX, y: clientY }); | ||
}; | ||
const [isDragging, setIsDragging] = useState(false); | ||
const imageRef = useRef(null); | ||
|
||
const handleDragStart = (e) => { | ||
e.dataTransfer.setData('text/plain', ''); // Necessary for some browsers | ||
setIsDragging(true); | ||
}; | ||
|
||
const handleDragEnd = () => { | ||
setIsDragging(false); | ||
}; | ||
|
||
const handleDrag = (e) => { | ||
if (isDragging) { | ||
handleImageDrag(e.clientX, e.clientY); | ||
} | ||
}; | ||
|
||
return ( | ||
<img | ||
ref={imageRef} | ||
src={imageUrl} | ||
alt="draggable" | ||
draggable | ||
onDragStart={handleDragStart} | ||
onDragEnd={handleDragEnd} | ||
onDrag={handleDrag} | ||
/> | ||
); | ||
}; | ||
|
||
export default DraggableImage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.card { | ||
position: relative; | ||
width: 200px; | ||
height: 200px; | ||
transition: box-shadow 0.5s, opacity 0.5s; | ||
will-change: transform; | ||
border: 10px solid white; | ||
cursor: grab; | ||
overflow: hidden; | ||
touch-action: none; | ||
} | ||
img { | ||
|
||
transform: translate(-50%, -50%); | ||
} | ||
|
||
.container { | ||
height: 100vh; | ||
width: 100vw; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.