From ab7595dd495191cb859f3ad7970b3fefaefce55d Mon Sep 17 00:00:00 2001 From: Baek SeungMin Date: Mon, 11 Jul 2022 09:19:07 +0900 Subject: [PATCH] slide pagination (not done) --- frontend/src/Pages/picpagination.tsx | 18 +++++++-- frontend/src/home/body.tsx | 57 ++++++++++++++++++++-------- frontend/tailwind.config.js | 11 ++++-- 3 files changed, 62 insertions(+), 24 deletions(-) diff --git a/frontend/src/Pages/picpagination.tsx b/frontend/src/Pages/picpagination.tsx index c1b221b..09a4777 100644 --- a/frontend/src/Pages/picpagination.tsx +++ b/frontend/src/Pages/picpagination.tsx @@ -1,14 +1,15 @@ import React from "react"; type num = { - total: number, + // total: number, page: number, setPage: Function } -export default function Pagination ({total, page, setPage} : num) { - const numPages = Math.ceil(total / 15); - +// export function PaginationLeft ({total, page, setPage} : num) { + // const numPages = Math.ceil(total / 15); +export function PaginationLeft ({ page, setPage} : num) { + const numPages = 3 return (
))} */} +
+ ); +}; +// export function PaginationRight ({total, page, setPage} : num) { +// const numPages = Math.ceil(total / 15); +export function PaginationRight ({ page, setPage} : num) { + const numPages = 3; + return ( +
diff --git a/frontend/src/home/body.tsx b/frontend/src/home/body.tsx index ccf19a4..73c68cf 100644 --- a/frontend/src/home/body.tsx +++ b/frontend/src/home/body.tsx @@ -3,7 +3,7 @@ import { Outlet, useSearchParams } from "react-router-dom"; import Theme from "./theme"; import Citylist from "../Pages/citylist"; import { getPicure } from "../Pages/pic"; -import Pagination from "../Pages/picpagination"; +import { PaginationLeft ,PaginationRight} from "../Pages/picpagination"; const initSearchParams = { theme: "", city: "" }; @@ -12,7 +12,7 @@ export default function Body() { const [searchParams, setSearchParams] = useSearchParams(initSearchParams); const [page, setPage] = useState(1); const offset = (page - 1) * limit; - + const [selected, setSelected] = useState(1); let getPics = getPicure(); useEffect(() => { @@ -48,25 +48,35 @@ export default function Body() { ); }); + const pre = () =>{ + setSelected(selected -1) + }; + + const next = () =>{ + setSelected(selected + 1) + }; + return (
- -
- {Idpics.slice(offset, offset + limit).map((pic, index: number) => ( -
- -

{pic.name}

+
+ +
+
+
+ + +
+
+
+
+ + + +
- ))} - +
@@ -75,3 +85,18 @@ export default function Body() { // Body Page ); } +{/*
*/} + {/* {Idpics.slice(offset, offset + limit).map((pic, index: number) => ( +
+ +

{pic.name}

+
+ ))} */} + {/* */} + {/* */} \ No newline at end of file diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js index 0ca9fa0..ac6c416 100644 --- a/frontend/tailwind.config.js +++ b/frontend/tailwind.config.js @@ -5,15 +5,18 @@ module.exports = { extend: { keyframes: { wave: { - '0%': { left: '100' }, + '0%': { left: '100%' }, '4%': { left: '0' }, '33.33%': { left: '0' }, - '37.33%': { left: '-100' }, - '100%': { left: '-100' }, + '37.33%': { left: '-100%' }, + '66.66%': { left: '-100%' }, + '70.66%': { left: '-200%' }, + '99.99%': { left: '-200%' }, + '100%': { left: '0%' }, } }, animation: { - wave : 'wave 10s ease-in-out' + wave : 'wave 12s ease-in-out' } }, }, -- GitLab