Skip to content

Commit 3996c8e

Browse files
authored
fix pagination centering (#758)
1 parent 72a399a commit 3996c8e

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nordcloud/gnui",
33
"description": "Nordcloud Design System - a collection of reusable React components used in Nordcloud's SaaS products",
4-
"version": "11.2.1",
4+
"version": "11.2.2",
55
"license": "MIT",
66
"repository": {
77
"type": "git",

src/components/extendedPagination/ExtendedPagination.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function Pagination({
1616
set,
1717
size,
1818
firstPage = 0,
19+
small,
1920
}: IExtendedPaginationProps) {
2021
const currentPage = Math.ceil(from / size);
2122
const nPages = Math.ceil(count / size);
@@ -60,10 +61,9 @@ function Pagination({
6061

6162
return (
6263
<nav
63-
className="pagination"
64+
className={`pagination ${!small ? "center-absolutely" : ""}`}
6465
role="navigation"
6566
aria-label="pagination"
66-
style={{ transform: "translate(-50%, 0)" }}
6767
>
6868
<ul className="pagination-list">
6969
<When condition={currentPage > firstPage}>
@@ -172,6 +172,7 @@ export function ExtendedPaginationBox({
172172
/>
173173
)}
174174
<Pagination
175+
small={small}
175176
from={from}
176177
set={setPage}
177178
size={size}

src/components/paginationHelpers/PaginationBox.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from "styled-components";
2-
import theme from "../../theme";
2+
import theme, { bp } from "../../theme";
33

44
type Props = {
55
sidebar?: boolean;
@@ -8,6 +8,7 @@ type Props = {
88

99
export const StyledPaginationBox = styled.nav<Props>`
1010
display: flex;
11+
position: relative;
1112
flex-wrap: wrap;
1213
flex: ${({ sidebar }) => (sidebar ? 1 : 0)};
1314
background-color: ${theme.color.background.ui03};
@@ -43,6 +44,14 @@ export const StyledPaginationBox = styled.nav<Props>`
4344
margin: 0;
4445
}
4546
47+
${bp("lg")`
48+
.center-absolutely {
49+
position: absolute;
50+
left: 50%;
51+
transform: translate(-50%, 0);
52+
}
53+
`}
54+
4655
button {
4756
display: flex;
4857
align-items: center;

src/components/paginationHelpers/types.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ export type IPaginationProps = {
1919

2020
export type IExtendedPaginationProps = Omit<IPaginationProps, "current"> & {
2121
from: number;
22+
small?: boolean;
2223
};

0 commit comments

Comments
 (0)