Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
shopping-mall
Commits
f31064c6
Commit
f31064c6
authored
Jan 26, 2021
by
kusang96
Browse files
pagination
parent
b7ade783
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Pagination.js
View file @
f31064c6
import
React
from
'
react
'
;
import
{
Pagination
}
from
'
react-bootstrap
'
;
function
Paginations
(
props
)
{
function
Paginations
(
{
inedx
,
endPage
,
handlePage
}
)
{
return
(
<
Pagination
>
<
Pagination
.
First
onClick
=
{()
=>
props
.
handlePage
(
1
)}
/
>
{
props
.
index
===
1
?
<
Pagination
.
Prev
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
)}
/> : <Pagination.Prev onClick={
()
=>
props.
handlePage
(
props.
index - 1
)
} /
>
}
{
props
.
index
===
props
.
endPage
-
1
?
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
-
3
)}
>
{
props
.
index
-
3
}
<
/Pagination.Item> : ""
}
{
props
.
index
===
props
.
endPage
?
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
-
4
)}
>
{
props
.
index
-
4
}
<
/Pagination.Item> : ""
}
{
props
.
index
===
props
.
endPage
?
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
-
3
)}
>
{
props
.
index
-
3
}
<
/Pagination.Item> : ""
}
{
props
.
index
<
3
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
-
2
)}
>
{
props
.
index
-
2
}
<
/Pagination.Item>
}
{
props
.
index
===
1
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
-
1
)}
>
{
props
.
index
-
1
}
<
/Pagination.Item>
}
<
Pagination
.
First
onClick
=
{()
=>
handlePage
(
1
)}
/
>
{
index
===
1
?
<
Pagination
.
Prev
onClick
=
{()
=>
handlePage
(
index
)}
/> : <Pagination.Prev onClick={
()
=>handlePage
(
index - 1
)
} /
>
}
{
index
===
endPage
-
1
?
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
-
3
)}
>
{
index
-
3
}
<
/Pagination.Item> : ""
}
{
index
===
endPage
?
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
-
4
)}
>
{
index
-
4
}
<
/Pagination.Item> : ""
}
{
index
===
endPage
?
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
-
3
)}
>
{
index
-
3
}
<
/Pagination.Item> : ""
}
{
index
<
3
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
-
2
)}
>
{
index
-
2
}
<
/Pagination.Item>
}
{
index
===
1
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
-
1
)}
>
{
index
-
1
}
<
/Pagination.Item>
}
<
Pagination
.
Item
active
>
{
props
.
index
}
<
/Pagination.Item
>
<
Pagination
.
Item
active
>
{
index
}
<
/Pagination.Item
>
{
props
.
index
===
props
.
endPage
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
+
1
)}
>
{
props
.
index
+
1
}
<
/Pagination.Item>
}
{
props
.
index
>
props
.
endPage
-
2
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
+
2
)}
>
{
props
.
index
+
2
}
<
/Pagination.Item>
}
{
props
.
index
===
1
?
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
+
3
)}
>
{
props
.
index
+
3
}
<
/Pagination.Item> : ""
}
{
props
.
index
===
1
?
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
+
4
)}
>
{
props
.
index
+
4
}
<
/Pagination.Item> : ""
}
{
props
.
index
===
2
?
<
Pagination
.
Item
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
+
3
)}
>
{
props
.
index
+
3
}
<
/Pagination.Item> : ""
}
{
props
.
index
===
props
.
endPage
?
""
:
<
Pagination
.
Next
onClick
=
{()
=>
props
.
handlePage
(
props
.
index
+
1
)}
/>
}
{
index
===
endPage
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
+
1
)}
>
{
index
+
1
}
<
/Pagination.Item>
}
{
index
>
endPage
-
2
?
""
:
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
+
2
)}
>
{
index
+
2
}
<
/Pagination.Item>
}
{
index
===
1
?
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
+
3
)}
>
{
index
+
3
}
<
/Pagination.Item> : ""
}
{
index
===
1
?
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
+
4
)}
>
{
index
+
4
}
<
/Pagination.Item> : ""
}
{
index
===
2
?
<
Pagination
.
Item
onClick
=
{()
=>
handlePage
(
index
+
3
)}
>
{
index
+
3
}
<
/Pagination.Item> : ""
}
{
index
===
endPage
?
""
:
<
Pagination
.
Next
onClick
=
{()
=>
handlePage
(
index
+
1
)}
/>
}
<
Pagination
.
Last
onClick
=
{()
=>
props
.
handlePage
(
props
.
endPage
)}
/
>
<
Pagination
.
Last
onClick
=
{()
=>
handlePage
(
endPage
)}
/
>
<
/Pagination
>
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment