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

삭제시 유저 확인(authenticate)

parent 27e8f6a0
import React, { useRef, useState } from "react"; import React, { useRef, useState } from "react";
type num = { type num = {
slides: any[], slides: any[];
} };
export function MySlide({ slides}: num) {
export function MySlide({ slides }: num) {
const firstLeftClick = useRef(true); const firstLeftClick = useRef(true);
const firstRightClick = useRef(true); const firstRightClick = useRef(true);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [slide,setSlide] = useState(1); const [slide, setSlide] = useState(1);
// const slide = useRef(1); // const slide = useRef(1);
const [style, setStyle] = useState(""); const [style, setStyle] = useState("");
...@@ -18,10 +17,10 @@ export function MySlide({ slides}: num) { ...@@ -18,10 +17,10 @@ export function MySlide({ slides}: num) {
firstLeftClick.current = false; firstLeftClick.current = false;
firstRightClick.current = true; firstRightClick.current = true;
} else { } else {
setPage(page - 1) setPage(page - 1);
} }
// slide.current -= 1; // slide.current -= 1;
setSlide(slide-1) setSlide(slide - 1);
setStyle("-translate-x-full animate-slidetoright"); setStyle("-translate-x-full animate-slidetoright");
}; };
...@@ -30,35 +29,43 @@ export function MySlide({ slides}: num) { ...@@ -30,35 +29,43 @@ export function MySlide({ slides}: num) {
firstLeftClick.current = true; firstLeftClick.current = true;
firstRightClick.current = false; firstRightClick.current = false;
} else { } else {
setPage(page + 1) setPage(page + 1);
} }
// slide.current += 1; // slide.current += 1;
setSlide(slide+1) setSlide(slide + 1);
setStyle("animate-slidetoleft"); setStyle("animate-slidetoleft");
}; };
return ( return (
<div className="flex flex-row justify-center items-center "> <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}> <button
className="mx-3 w-6 h-6 rounded-full hover:bg-sky-100 hover:text-gray-400"
onClick={leftClick}
disabled={slide === 1}
>
&lt; &lt;
</button> </button>
<div <div
className={`m-3 md:m-5 md:basis-4/5 flex flex-row relative w-full overflow-hidden`} 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) => ( {slides.slice(page - 1, page + 2).map((slide) => (
<div key={Math.random()} className="min-w-full" <div key={Math.random()} className="min-w-full">
<div
key={slide}
className={`inline-grid grid-cols-2 ${style} min-w-full`}
> >
<div key={slide} className={`inline-grid grid-cols-2 ${style} min-w-full`}>
{slide} {slide}
</div> </div>
</div> </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}> <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; &gt;
</button> </button>
</div> </div>
); );
}; }
...@@ -87,11 +87,11 @@ export default function Body() { ...@@ -87,11 +87,11 @@ export default function Body() {
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
<Theme handleClick={themeHandleClick} /> <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"> <div className="md:w-1/5 lg:w-1/6">
<Citylist handleClick={cityHandleClick} /> <Citylist handleClick={cityHandleClick} />
</div> </div>
<div className="flex flex-col"> <div className="flex flex-col mt-5">
<MySlide key={Math.random()} slides={slides} /> <MySlide key={Math.random()} slides={slides} />
</div> </div>
</div> </div>
......
...@@ -28,10 +28,10 @@ export default function Header() { ...@@ -28,10 +28,10 @@ export default function Header() {
</button> </button>
<div className="flex h-12"> <div className="flex h-12">
<input <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} 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> </button>
</div> </div>
...@@ -80,7 +80,7 @@ export default function Header() { ...@@ -80,7 +80,7 @@ export default function Header() {
<Outlet /> <Outlet />
</div> </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> </div>
); );
} }
...@@ -8,7 +8,7 @@ export default function Citylist({ handleClick }: CityProps) { ...@@ -8,7 +8,7 @@ export default function Citylist({ handleClick }: CityProps) {
const [active, setActive] = useState(0); const [active, setActive] = useState(0);
const onactive = 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"; "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 offactive = "text-start px-5 py-2 whitespace-nowrap w-full ";
const clickActive = (a: number) => { const clickActive = (a: number) => {
...@@ -16,10 +16,10 @@ export default function Citylist({ handleClick }: CityProps) { ...@@ -16,10 +16,10 @@ export default function Citylist({ handleClick }: CityProps) {
}; };
return ( return (
<div className="overflow-auto w-full flex flex-row md:flex-col md:mr-24 bg-red-100 shadow-lg"> <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 className="text-start px-5 py-2 bg-white whitespace-nowrap">
도시 도시
</div> </div> */}
<div onClick={() => clickActive(1)}> <div onClick={() => clickActive(1)}>
<button <button
id={"Seoul"} id={"Seoul"}
......
...@@ -12,7 +12,7 @@ router ...@@ -12,7 +12,7 @@ router
.route("/:postId") .route("/:postId")
.post(authCtrl.requireLogin, postCtrl.addCounts) .post(authCtrl.requireLogin, postCtrl.addCounts)
.delete(authCtrl.requireLogin, authCtrl.authenticate, postCtrl.deleteOnePost) .delete(authCtrl.requireLogin, authCtrl.authenticate, postCtrl.deleteOnePost)
.put(authCtrl.requireLogin, postCtrl.updateOnePost); .put(authCtrl.requireLogin, authCtrl.authenticate, postCtrl.updateOnePost);
router.param("postId", postCtrl.userByPostId); router.param("postId", postCtrl.userByPostId);
export default router; 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