Skip to content

Commit

Permalink
Merge pull request #164 from TRIP-Side-Project/dev
Browse files Browse the repository at this point in the history
Merge: 11차 합병 작업 [최종]
  • Loading branch information
Emma-Hyejin authored Jan 13, 2024
2 parents 6a561dc + 2c19de2 commit b4ef4d3
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 21 deletions.
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"postcss-nesting": "^12.0.2",
"prettier": "^3.1.0",
"tailwindcss": "^3.3.5",
"tailwindcss-animated": "^1.0.1",
"typescript": "^5.2.2",
"vite": "^5.0.0",
"vite-plugin-eslint": "^1.8.1"
Expand Down
6 changes: 3 additions & 3 deletions src/common/tag/RecoilTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const RecoilTag = ({
<div
className={
inputStyle
? "flex flex-row rounded-lg border border-BASIC_BLACK px-2 py-1 mt-2 w-full h-9"
: "flex text-sm font-semibold border bg-BAISC_WHITE flex-row px-3 rounded-xl border-BASIC_BLACK h-9"
? "flex flex-row rounded-lg border border-BASIC_BLACK px-2 py-1 mt-2 w-full h-fit md:h-9"
: "flex text-sm font-semibold border bg-BAISC_WHITE flex-row px-3 rounded-xl border-BASIC_BLACK h-fit md:h-9"
}
onClick={onOffTag}
>
<div className="flex flex-row ">
<div className="flex flex-row flex-wrap">
{filteredList.map((el, idx) => (
<TagItem
key={idx}
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/Mmenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Mmenu = ({ openNav, onSubMenuClose }: NavTypes) => {
</button>
</div>
{isOpen && (
<div className="absolute left-0 z-30 flex flex-col w-screen shadow-md bg-BASIC_WHITE top-32 dark:bg-BASIC_BLACK dark:text-BASIC_WHITE">
<div className="absolute left-0 z-50 flex flex-col w-screen shadow-md bg-BASIC_WHITE top-32 dark:bg-BASIC_BLACK dark:text-BASIC_WHITE">
<button
className="py-8 border-b font-xl border-LIGHT_GRAY_COLOR"
onClick={() => {
Expand Down
61 changes: 57 additions & 4 deletions src/components/homeSlider/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// import { useRef } from "react";
import "flowbite";

import slider1 from "@/assets/img/slider/slider1.png";
import slider2 from "@/assets/img/slider/slider2.png";
import slider3 from "@/assets/img/slider/slider3.png";
Expand All @@ -12,12 +14,12 @@ import slider10 from "@/assets/img/slider/slider10.png";
import slider11 from "@/assets/img/slider/slider11.png";
import slider12 from "@/assets/img/slider/slider12.png";
import slider13 from "@/assets/img/slider/slider13.png";
import { useEffect } from "react";
import { useEffect, useState } from "react";

// import type { CarouselItem, CarouselOptions, InstanceOptions } from "flowbite";

const Slider = () => {
useEffect(() => {
console.log(" 왜 안 되는지 확인 중 ");
}, []);
const [reload, setReload] = useState(true);
const imgArr = [
slider1,
slider2,
Expand All @@ -33,15 +35,66 @@ const Slider = () => {
slider12,
slider13,
];

useEffect(() => {
console.log(reload);
if (reload) {
setReload(false);
console.log("페이지 리로드");
}
}, []);
// const carouselRef = useRef<HTMLDivElement | null>(null);
// const itemRef = useRef<(HTMLDivElement | null)[]>(
// new Array(imgArr.length).fill(null),
// );

// useEffect(() => {
// const carouselElement = carouselRef.current;
// if (carouselElement) {
// console.log(carouselElement);

// const items: CarouselItem[] = itemRef.current
// .map((ref, idx) => ({
// position: idx,
// el: ref as HTMLElement,
// }))
// .filter((item): item is CarouselItem => item.el !== null);

// const options: CarouselOptions = {
// defaultPosition: 1,
// interval: 3000,
// };

// const instanceOptions: InstanceOptions = {
// id: "carousel-example",
// override: true,
// };

// const carousel = new Carousel(
// carouselElement,
// items,
// options,
// instanceOptions,
// );
// carousel.cycle();

// return () => {
// carousel.pause();
// };
// }
// }, []);

return (
<div
// ref={carouselRef}
id="default-carousel"
className="relative w-full"
data-carousel="slide"
>
<div className="relative h-80 overflow-hidden rounded-lg md:h-[420px]">
{imgArr.map((img, idx) => (
<div
// ref={(el) => (itemRef.current[idx + 1] = el)}
className="hidden duration-700 ease-in-out"
data-carousel-item
key={idx}
Expand Down
135 changes: 135 additions & 0 deletions src/components/homeSlider/Slider2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import slider1 from "@/assets/img/slider/slider1.png";
import slider2 from "@/assets/img/slider/slider2.png";
import slider3 from "@/assets/img/slider/slider3.png";
import slider4 from "@/assets/img/slider/slider4.png";
import slider5 from "@/assets/img/slider/slider5.png";
import slider6 from "@/assets/img/slider/slider6.png";
import slider7 from "@/assets/img/slider/slider7.png";
import slider8 from "@/assets/img/slider/slider8.png";
import slider9 from "@/assets/img/slider/slider9.png";
import slider10 from "@/assets/img/slider/slider10.png";
import slider11 from "@/assets/img/slider/slider11.png";
import slider12 from "@/assets/img/slider/slider12.png";
import slider13 from "@/assets/img/slider/slider13.png";
import { useEffect, useState } from "react";
const Slider2 = () => {
const imgArr = [
slider1,
slider2,
slider3,
slider4,
slider5,
slider6,
slider7,
slider8,
slider9,
slider10,
slider11,
slider12,
slider13,
];

const [currentIndex, setCurrentIndex] = useState(0);

const prevImage = () => {
setCurrentIndex((prev) => (prev === 0 ? imgArr.length - 1 : prev - 1));
};

const nextImage = () => {
setCurrentIndex((prev) => (prev === imgArr.length - 1 ? 0 : prev + 1));
};

useEffect(() => {
// 이미지를 자동으로 변경하기 위한 타이머 설정
const intervalId = setInterval(() => {
// 다음 이미지로 넘기기
setCurrentIndex((prevIndex) =>
prevIndex === imgArr.length - 1 ? 0 : prevIndex + 1,
);
}, 3000); // 3초마다 이미지 변경

// 컴포넌트가 언마운트될 때 타이머 해제
return () => clearInterval(intervalId);
}, []); // 빈 배열을 전달하여 컴포넌트가 처음 렌더링될 때만 실행

Check warning on line 53 in src/components/homeSlider/Slider2.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

React Hook useEffect has a missing dependency: 'imgArr.length'. Either include it or remove the dependency array

return (
<div className="relative w-full ">
<div className="relative h-80 overflow-hidden rounded-lg md:h-[420px] ">
{imgArr.map((img, idx) => (
<div className="" key={idx}>
{/* 첫 번째 이미지에 대한 배경 처리 */}
<img
src={img}
alt={`Image ${idx}`}
className="absolute top-0 left-0 w-full h-full "
style={{
transition: "opacity 0.7s ease-in-out",
opacity: idx === currentIndex ? 0.6 : 0, // 현재 이미지면 투명도 1, 아니면 0
}}
/>
{/* 주 이미지 처리 */}
<img
src={img}
alt={`Image ${idx}`}
className="absolute w-4/5 transform -translate-x-1/2 -translate-y-1/2 h-3/4 top-1/2 left-1/2"
style={{
transition: "opacity 0.7s ease-in-out",
opacity: idx === currentIndex ? 1 : 0, // 현재 이미지면 투명도 1, 아니면 0
}}
/>
</div>
))}
</div>
<button
type="button"
className="absolute top-0 z-30 items-center justify-center hidden h-full px-4 cursor-pointer md:flex start-0 group focus:outline-none"
onClick={prevImage}
>
<span className="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none">
<svg
className="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 6 10"
>
<path
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M5 1 1 5l4 4"
/>
</svg>
<span className="sr-only">Previous</span>
</span>
</button>
<button
type="button"
className="absolute top-0 z-30 items-center justify-center hidden h-full px-4 cursor-pointer md:flex end-0 group focus:outline-none"
onClick={nextImage}
>
<span className="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none">
<svg
className="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 6 10"
>
<path
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="m1 9 4-4-4-4"
/>
</svg>
<span className="sr-only">Next</span>
</span>
</button>
</div>
);
};

export default Slider2;
6 changes: 3 additions & 3 deletions src/components/mineItems/LikeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ const Likeitem = ({ data }: LikeMerchanProps) => {
>
<img
src={data.imageUrl}
className="rounded-lg w-[130px] h-[100px] mr-3"
className="rounded-lg w-[100px] sm:w-[130px] h-[100px] mr-3"
/>
<div className="flex flex-col flex-1 text-BASIC_BLACK">
<div className="flex flex-row justify-between">
<div className="text-lg font-semibold">
<div className="flex flex-row justify-between ">
<div className="text-sm font-semibold whitespace-normal sm:text-lg">
{data.title.slice(0, 28)}..
</div>
<button
Expand Down
14 changes: 7 additions & 7 deletions src/components/modal/MypageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,28 @@ const MyPageModal = ({ isClick, data, setIsOpen }: TempProps) => {

return (
<div className="fixed inset-0 z-50 flex items-end justify-center w-screen min-h-full p-4 overflow-y-auto text-center transition-opacity bg-gray-500 bg-opacity-75 sm:items-center sm:p-0">
<div className="relative px-10 py-5 overflow-hidden text-left transition-all transform bg-white rounded-lg shadow-xl w-[560px]">
<div className="relative h-[600px] sm:h-fit px-5 md:px-10 py-5 overflow-y-auto md:overflow-hidden text-left transition-all transform bg-white rounded-lg shadow-xl md:w-[560px]">
<button className="float-right px-3 pb-2 mt-2" onClick={isClick}>
<Close fillColor={"#333333"} width={"18px"} height={"18px"} />
</button>
<form className="my-10">
<div className={titleStyle}> 프로필 이미지</div>
<div className="flex flex-row items-center justify-around w-full h-32 p-5 rounded-lg w bg-zinc-300">
<div className="flex w-full p-3 rounded-lg h-fit sm:h-32 flex-rowitems-center bg-zinc-300">
<img
src={myImg}
alt="마이 프로필 이미지"
className="h-24 mr-5 rounded-full shadow-lg"
className="h-[70px] mr-5 my-auto rounded-full shadow-lg md:h-24"
/>
<div>
<p className="ml-2 text-xs font-normal text-ETC_COLOR">
<div className="">
<p className="ml-2 text-[11px] md:text-xs font-normal text-ETC_COLOR">
! 10kb 미만의 사진을 업로드 해주세요!
</p>
<p className="ml-2 text-xs font-normal text-ETC_COLOR">
<p className="ml-2 text-[11px] md:text-xs font-normal text-ETC_COLOR ">
! 등록하시지 않을 경우 기본 이미지가 업로드 됩니다.
</p>
<input
type="file"
className="mt-3"
className="w-24 mt-3 md:w-64"
onChange={(e) => {
if (e.currentTarget.files?.[0]) {
const file = e.currentTarget.files[0];
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { menuSelector } from "@/store/menuState";
import { useRecoilValue, useSetRecoilState } from "recoil";
import { tempTags } from "@/store/tagState";
import _ from "lodash";
import Slider from "@/components/homeSlider/Slider";
import Slider from "@/components/homeSlider/Slider2";

export default function Home() {
const sectionTitle =
Expand Down Expand Up @@ -47,7 +47,6 @@ export default function Home() {

useEffect(() => {
window.addEventListener("resize", resizeListener);

return () => {
resizeListener.cancel();
window.removeEventListener("resize", resizeListener);
Expand Down Expand Up @@ -92,7 +91,7 @@ export default function Home() {
<div className="flex flex-col w-full gap-20 bg-BASIC_WHITE dark:bg-BASIC_BLACK dark:text-BASIC_WHITE">
<Slider />
<div className="absolute w-full">
<div className="absolute origin-top-right md:left-[480px] z-30 flex flex-col justify-center md:h-[420px] gap-4 px-10 bg-[rgba(0,0,0,0.4)] md:w-1/3 w-full h-80">
<div className="absolute origin-top-right md:left-[480px] z-20 flex flex-col justify-center md:h-[420px] gap-4 px-10 bg-[rgba(0,0,0,0.4)] md:w-1/3 w-full h-80">
<h1 className="my-5 text-2xl text-BASIC_WHITE">출발지</h1>
<div className="relative flex flex-row border-b text-BASIC_WHITE ">
<span className="inline-block">
Expand Down

0 comments on commit b4ef4d3

Please sign in to comment.