From 4b55008f16c01f59d486a76fe9be556154b99c7d Mon Sep 17 00:00:00 2001 From: b1ek Date: Tue, 9 May 2023 11:40:59 +1000 Subject: [PATCH] finish index page (readonly) --- .../src/pages/IndexPage/index.jsx | 66 +++++++++++++++++-- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/pairent_frontend_react/src/pages/IndexPage/index.jsx b/pairent_frontend_react/src/pages/IndexPage/index.jsx index 7b03e95..975e2f1 100644 --- a/pairent_frontend_react/src/pages/IndexPage/index.jsx +++ b/pairent_frontend_react/src/pages/IndexPage/index.jsx @@ -36,8 +36,8 @@ const SwiperImage = styled.div` background-repeat: no-repeat; background-size: cover; - width: 800px; - height: 400px; + width: 100%; + height: 100%; `; const Filters = styled.div` @@ -45,6 +45,7 @@ const Filters = styled.div` height: 300px; width: 1150px; margin: 0 auto; + margin-bottom: 60px; border-radius: 20px; box-shadow: 0 2px 12px #00000060; padding: 30px; @@ -134,6 +135,37 @@ const SearchBarInput = styled.input` outline: none; `; +const PageButtons = styled.div` + margin: 60px auto; + width: fit-content +`; + +const PageButton = styled.button` + background: #dedede; + width: 60px; height: 60px; + border-radius: 16px; + box-shadow: 0 1px 2px #20202060; + margin-right: 32px; + font-size: 20px; + font-weight: bold; + + transition: 350ms ease; + + &:hover { + box-shadow: 0 2px 4px #20202060; + } +`; + +const CurrentPage = styled(PageButton)` + background: 0; + border: 2px solid royalblue; +`; + +const IndexPageRoot = styled.div` + width: 1150px; + margin: 50px auto +`; + const FiltersForm = () => { const apart_sizes = [ @@ -279,15 +311,16 @@ export default class IndexPage extends React.Component { render() { const { page, pageSize } = this.state; + const pages = this.state.apartments.length / pageSize; + const current_data = this.state.apartments.slice((page * pageSize), (page * pageSize) + pageSize); - console.log(current_data); + return ( - <> -
+ : null } - + + + { + [...Array(pages)].map((_, i) => { + if (i > 3 && i != pageSize - 1) { + if (i == 4) + return ...; + return null; + } + + if (i == page) + return {i + 1} + + return ( + {i + 1} + ); + }) + } + + ); } } \ No newline at end of file