Skip to content

Commit

Permalink
Merge pull request #5 from GDSC-StreetReview/docs/#4
Browse files Browse the repository at this point in the history
Docs/#4 기능 추가
  • Loading branch information
KKangHHee authored May 20, 2024
2 parents 9aff475 + 87eafb3 commit 34ef967
Show file tree
Hide file tree
Showing 84 changed files with 2,551 additions and 10,894 deletions.
306 changes: 306 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"last 1 safari version"
]
},
"proxy": "http://semtle.catholic.ac.kr:8085/",
"devDependencies": {
"dotenv-cli": "^7.4.1",
"tsconfig-paths-webpack-plugin": "^4.1.0"
Expand Down
14 changes: 7 additions & 7 deletions src/Pages/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useState } from "react";
import MainToggle from "../../components/Main/MainToggle/MainToggle";
import TopSearchBar from "../../components/Main/TopSearchBar/TopSearchBar";
import MainToggle from "src/components/Main/components/MainToggle";
import TopSearchBar from "src/components/Main/components/TopSearchBar";

const MainPage = () => {
const [isOpenSideBar, setIsOpenSideBar] = useState<boolean>(false);
const handleIsOpenSideBar = () => {
setIsOpenSideBar((prer) => !prer);
};
// const [isOpenSideBar, setIsOpenSideBar] = useState<boolean>(false);
// const handleIsOpenSideBar = () => {
// setIsOpenSideBar((prer) => !prer);
// };
return (
<>
<TopSearchBar />
Expand Down
Binary file added src/assets/images/basic_color_img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/basic_img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/ic_arrow_right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/ic_gallery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/ic_mypage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/ic_report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/ic_x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/img_upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/components/Atom/ImageModal/ImageModal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.image__modal__wrapper{
width: 100%;
height: 100%;
}
.image__modal__content {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.image__modal__content img {
object-fit: contain;
}
.image__modal__currentIndex {
margin-left: auto;
}
.image__modal__control {
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
left: 50%;
width: 90%;
display: flex;
justify-content: space-between;
}
.image__modal__control div {
cursor: pointer;
}
52 changes: 52 additions & 0 deletions src/components/Atom/ImageModal/ImageModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { useState } from "react";
import { IMAGES } from "src/constants/images";
import { Arrow } from "../arrow/Arrow";
import "./ImageModal.css";
interface ImageModalProps {
imageList?: string[];
}
export const ImageModal = ({ imageList = [IMAGES.basicImg] }: ImageModalProps) => {
const [currentIndex, setCurrentIndex] = useState<number>(0);
const [startX, setStartX] = useState<number>(0);

const handleTouchStart = (e: React.TouchEvent<HTMLDivElement>) => {
setStartX(e.touches[0].pageX);
};

const handleSwipe = (endX: number) => {
const diffX = startX - endX;
if (diffX > 50) {
handlePrevNext(-1);
} else if (diffX < -50) {
handlePrevNext(1);
}
};

const handleTouchMove = (e: React.TouchEvent<HTMLDivElement>) => {
handleSwipe(e.touches[0].pageX);
};
const handlePrevNext = (delta: number) => {
const newIndex = currentIndex + delta;
if (newIndex >= 0 && newIndex < imageList.length) setCurrentIndex(newIndex);
};

return (
<div
className="image__modal__wrapper"
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
>
<div className="image__modal__content">
<img
src={encodeURI(imageList[currentIndex])}
alt="contentImg"
className="image__modal__image"
/>
<div className="image__modal__control">
<Arrow onClick={() => handlePrevNext(-1)} isLeft={true} />
<Arrow onClick={() => handlePrevNext(1)} />
</div>
</div>
</div>
);
};
27 changes: 27 additions & 0 deletions src/components/Atom/arrow/Arrow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { IMAGES } from "src/constants/images";

interface arrowProps {
onClick: () => void;
width?: string;
height?: string;
isLeft?: boolean;
}

export const Arrow = ({
onClick,
width = "0.875rem",
height = "1.64063rem",
isLeft = false,
}: arrowProps) => {
const style: React.CSSProperties = {
transform: isLeft ? "rotate(180deg)" : "",
width: width,
height: height,
cursor: "pointer",
};
return (
<div onClick={onClick}>
<img src={IMAGES.arrowRight} alt="arrowLeft" style={style} />
</div>
);
};
29 changes: 29 additions & 0 deletions src/components/Atom/backgroundImg/BackgroundImg.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ReactNode } from "react";

export interface BackgroundImgProps {
children?: ReactNode;
img: string;
className?: string;
onClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
}

export function BackgroundImg({
children,
className = "",
img,
onClick,
}: BackgroundImgProps) {
console.log("iiiiii",img);
return (
<div
style={{
background: `url(${encodeURI(img)}) lightgray 50% / cover
no-repeat`,
}}
className={className}
onClick={onClick}
>
{children}
</div>
);
}
19 changes: 19 additions & 0 deletions src/components/Atom/commentBox/CommentBox.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.comment-box-wrapper {
display: flex;
align-items: center;
margin-bottom: 0.4rem;
}
.comment-box-user-info {
display: flex;
align-items: center;
margin-right: 0.5rem;
}
.comment-box-user-profile {
width: 1.875rem;
height: 1.875rem;
border-radius: 50%;
}
.comment-box-user-name {
text-align: center;
margin-left: 0.5rem;
}
33 changes: 33 additions & 0 deletions src/components/Atom/commentBox/CommentBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Comment } from "src/constants/interface";
import { BackgroundImg } from "../backgroundImg/BackgroundImg";
import { Text } from "../text/Text";
import "./CommentBox.css";

const CommentBox = ({ commentItem }: { commentItem: Comment }) => {
return (
<div className="comment-box-wrapper">
<div className="comment-box-user-info">
{commentItem.member.picture && (
<BackgroundImg
img={commentItem.member.picture}
// img={IMAGES.basicColorImg}
className="comment-box-user-profile"
/>
)}
<Text
color="#000"
fontSize="0.75rem"
fontWeight="700"
className="comment-box-user-name"
>
{commentItem.member.nickName}
{/* 익명 */}
</Text>
</div>
<Text color="#000" fontSize="0.625rem" fontWeight="400">
{commentItem.replyContent}
</Text>
</div>
);
};
export default CommentBox;
50 changes: 50 additions & 0 deletions src/components/Atom/customModal/CustomModal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.custom-modal-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5); /* 반투명 배경 */
display: flex;
justify-content: center;
align-items: center;
z-index: 10;
}
.custom-modal-box {
width: 15.875rem;
height: 8.1875rem;
border-radius: 1.25rem;
background: #fff;
flex-direction: column;
display: flex;
align-items: center;
}
.custom-modal-title {
margin-top: 1rem;
margin-bottom: 0.5rem;
}

.custom-modal-box-buttom {
margin-top: auto;
display: flex;
align-items: center;
width: 100%;
}
.custom-modal-box-yes {
background: #ea4335;
height: 2.5625rem;
width: 50%;
border-radius: 0 0 0 1.25rem;
display: flex;
align-items: center;
justify-content: center;
}
.custom-modal-box-no {
background: #fff;
height: 2.5625rem;
width: 50%;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0 0 1.25rem 0;
}
40 changes: 40 additions & 0 deletions src/components/Atom/customModal/CustomModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Text } from "../text/Text";
import "./CustomModal.css";
interface CoustomModalProps {
title: string;
content: string;
onClick: () => void;
onClose: () => void;
}
const CustomModal = ({
title,
content,
onClick,
onClose,
}: CoustomModalProps) => {
return (
<div className="custom-modal-wrapper">
<div className="custom-modal-box">
<Text color="#EA4335" fontSize="1.25rem" fontWeight="700"className="custom-modal-title">
{title}
</Text>
<Text color="#000" fontSize="0.75rem" fontWeight="500" className="custom-modal-box-content">
{content}
</Text>
<div className="custom-modal-box-buttom">
<div onClick={onClick} className="custom-modal-box-yes">
<Text color="#fff" fontSize="0.75rem" fontWeight="500">
</Text>
</div>
<div onClick={onClose} className="custom-modal-box-no">
<Text color="#000" fontSize="0.75rem" fontWeight="500">
아니요
</Text>
</div>
</div>
</div>
</div>
);
};
export default CustomModal;
Empty file.
32 changes: 32 additions & 0 deletions src/components/Atom/customModal/logoutModal/LogoutModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import { logout } from "src/store/auth/authAction";
import CustomModal from "../CustomModal";
import "./LogoutModal.css";

interface logoutProp {
onClose: () => void;
}
const LogoutModal = ({ onClose }: logoutProp) => {
const navigate = useNavigate();
const dispatch = useDispatch();
const handleLogout = () => {
// localStorage.removeItem("token");
localStorage.clear();
dispatch(logout());
navigate("/");
onClose();
window.location.reload();
};
return (
<>
<CustomModal
title="로그아웃"
content="로그아웃 하시겠습니까?"
onClick={handleLogout}
onClose={onClose}
/>
</>
);
};
export default LogoutModal;
13 changes: 13 additions & 0 deletions src/components/Atom/mainToggleIcon/MainToggleIcon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.google-login-button {
margin-left: 0.56rem;
margin-right: 1rem;
width: 70%;
border-radius: 2.5rem;
box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.08),
0px 0px 1px 0px rgba(0, 0, 0, 0.17);
}
.menu-circle-img-style {
width: 1.26563rem;
height: 1.26563rem;
cursor: pointer;
}
15 changes: 15 additions & 0 deletions src/components/Atom/mainToggleIcon/MainToggleIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "./MainToggleIcon.css";
interface MainToggleIconProps {
onClick?: () => void;
imgSrc: string;
clasName?: string;
}
const MainToggleIcon = ({
imgSrc,
onClick,
clasName = "menu-circle-img-style",
}: MainToggleIconProps) => {
return <img className={clasName} onClick={onClick} src={imgSrc} alt="Icon" />;
};

export default MainToggleIcon;
16 changes: 16 additions & 0 deletions src/components/Atom/mappingImgItem/MappingImgItem.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.mapping__img__item__img {
position: relative;
}
.mapping__img__item__img img {
width: 15.125rem;
height: 15.125rem;
object-fit: cover;
border-radius: 0.625rem;
}
.mapping__img__item__remove img {
width: 1rem;
height: 1rem;
position: absolute;
top: 0.2rem;
right: 0.2rem;
}
Loading

0 comments on commit 34ef967

Please sign in to comment.