Commit 0086b124 authored by Lee Soobeom's avatar Lee Soobeom
Browse files

삭제시 유저 확인(authenticate)

parent 27e8f6a0
import React, { useRef, useState } from "react";
type num = {
slides: any[],
}
export function MySlide({ slides}: num) {
slides: any[];
};
const firstLeftClick = useRef(true);
const firstRightClick = useRef(true);
const [page, setPage] = useState(1);
const [slide,setSlide] = useState(1);
// const slide = useRef(1);
const [style, setStyle] = useState("");
export function MySlide({ slides }: num) {
const firstLeftClick = useRef(true);
const firstRightClick = useRef(true);
const [page, setPage] = useState(1);
const [slide, setSlide] = useState(1);
// const slide = useRef(1);
const [style, setStyle] = useState("");
const leftClick = () => {
if (firstLeftClick.current) {
firstLeftClick.current = false;
firstRightClick.current = true;
} else {
setPage(page - 1)
}
// slide.current -= 1;
setSlide(slide-1)
setStyle("-translate-x-full animate-slidetoright");
};
const leftClick = () => {
if (firstLeftClick.current) {
firstLeftClick.current = false;
firstRightClick.current = true;
} else {
setPage(page - 1);
}
// slide.current -= 1;
setSlide(slide - 1);
setStyle("-translate-x-full animate-slidetoright");
};
const rightClick = () => {
if (firstRightClick.current) {
firstLeftClick.current = true;
firstRightClick.current = false;
} else {
setPage(page + 1)
}
// slide.current += 1;
setSlide(slide+1)
setStyle("animate-slidetoleft");
};
const rightClick = () => {
if (firstRightClick.current) {
firstLeftClick.current = true;
firstRightClick.current = false;
} else {
setPage(page + 1);
}
// slide.current += 1;
setSlide(slide + 1);
setStyle("animate-slidetoleft");
};
return (
<div className="flex flex-row justify-center items-center ">
<button className="mx-3 w-6 h-6 rounded-full hover:bg-sky-100 hover:text-gray-400"onClick={leftClick} disabled={slide === 1}>
&lt;
</button>
return (
<div className="flex flex-row justify-center items-center ">
<button
className="mx-3 w-6 h-6 rounded-full hover:bg-sky-100 hover:text-gray-400"
onClick={leftClick}
disabled={slide === 1}
>
&lt;
</button>
<div
className={`m-3 md:m-5 md:basis-4/5 flex flex-row relative w-full overflow-hidden`}
>
{slides.slice(page - 1, page + 2).map((slide) => (
<div key={Math.random()} className="min-w-full">
<div
className={`m-3 md:m-5 md:basis-4/5 flex flex-row relative w-full overflow-hidden`}
key={slide}
className={`inline-grid grid-cols-2 ${style} min-w-full`}
>
{slides.slice(page - 1, page + 2).map((slide) => (
<div key={Math.random()} className="min-w-full"
>
<div key={slide} className={`inline-grid grid-cols-2 ${style} min-w-full`}>
{slide}
</div>
</div>
))}
{slide}
</div>
<button className="mx-3 w-6 h-6 rounded-full hover:bg-sky-100 hover:text-gray-400"onClick={rightClick} disabled={slide === slides.length}>
&gt;
</button>
</div>
);
};
</div>
))}
</div>
<button
className="mx-3 w-6 h-6 rounded-full hover:bg-sky-100 hover:text-gray-400"
onClick={rightClick}
disabled={slide === slides.length}
>
&gt;
</button>
</div>
);
}
......@@ -87,11 +87,11 @@ export default function Body() {
return (
<div className="flex flex-col">
<Theme handleClick={themeHandleClick} />
<div className="flex flex-col md:flex-row py-5 ">
<div className="flex flex-col md:flex-row py-8 ">
<div className="md:w-1/5 lg:w-1/6">
<Citylist handleClick={cityHandleClick} />
</div>
<div className="flex flex-col">
<div className="flex flex-col mt-5">
<MySlide key={Math.random()} slides={slides} />
</div>
</div>
......
......@@ -28,10 +28,10 @@ export default function Header() {
</button>
<div className="flex h-12">
<input
className="ml-10 focus:outline-none focus:border-y-4 focus:border-l-4 focus:border-sky-500 w-3/5 md:w-4/5 border-y-4 border-l-4 border-sky-300 pl-9 rounded-l-full focus:border-0"
className="ml-10 focus:outline-none focus:border-y-4 focus:border-l-4 focus:border-yellow-900 w-3/5 md:w-4/5 border-y-4 border-l-4 border-yellow-600 pl-9 rounded-l-full focus:border-0"
onChange={handleChange}
/>
<button className="whitespace-nowrap bg-white border-y-4 border-r-4 border-sky-500 rounded-r-full pr-4">
<button className="whitespace-nowrap bg-white border-y-4 border-r-4 border-yellow-900 rounded-r-full pr-4">
검색
</button>
</div>
......@@ -80,7 +80,7 @@ export default function Header() {
<Outlet />
</div>
<div className="bg-center z-0 absolute w-full h-44 overflow-hidden object-cover object-center bg-[url('https://blog.kakaocdn.net/dn/b5qUMZ/btqN9NEYqcW/ZuZmPcI4u7bdK89shT3RL1/img.jpg')]"></div>
<div className="bg-right bg-cover z-0 absolute w-full h-44 overflow-hidden object-cover object-center bg-[url('https://a-static.besthdwallpaper.com/seom-punggyeong-ilreoseuteu-byeogji-3840x1200-81006_62.jpg')]"></div>
</div>
);
}
......@@ -8,18 +8,18 @@ export default function Citylist({ handleClick }: CityProps) {
const [active, setActive] = useState(0);
const onactive =
"text-start px-5 py-2 whitespace-nowrap w-full border-b-4 md:border-b-0 md:border-r-4 border-sky-500";
const offactive = "text-start px-5 py-2 whitespace-nowrap w-full ";
"text-start px-5 py-2 whitespace-nowrap w-full border-b-4 md:border-b-0 md:border-r-4 border-lime-500";
const offactive = "text-start px-5 py-2 whitespace-nowrap w-full ";
const clickActive = (a: number) => {
setActive(a);
};
return (
<div className="overflow-auto w-full flex flex-row md:flex-col md:mr-24 bg-red-100 shadow-lg">
<div className="text-start px-5 py-2 bg-white whitespace-nowrap">
<div className="overflow-auto w-full md:w-36 flex flex-row md:flex-col md:mr-24 bg-lime-100 shadow-lg">
{/* <div className="text-start px-5 py-2 bg-white whitespace-nowrap">
도시
</div>
</div> */}
<div onClick={() => clickActive(1)}>
<button
id={"Seoul"}
......
......@@ -12,7 +12,7 @@ router
.route("/:postId")
.post(authCtrl.requireLogin, postCtrl.addCounts)
.delete(authCtrl.requireLogin, authCtrl.authenticate, postCtrl.deleteOnePost)
.put(authCtrl.requireLogin, postCtrl.updateOnePost);
.put(authCtrl.requireLogin, authCtrl.authenticate, postCtrl.updateOnePost);
router.param("postId", postCtrl.userByPostId);
export default router;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment