This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 863863aa5 refactor(config-ui): remove unuse component pagination
(#6609)
863863aa5 is described below
commit 863863aa5618705f40957c21be099b6c84de62cb
Author: 青湛 <[email protected]>
AuthorDate: Mon Dec 11 12:37:26 2023 +0800
refactor(config-ui): remove unuse component pagination (#6609)
---
config-ui/src/components/index.ts | 1 -
config-ui/src/components/pagination/index.tsx | 58 ---------------------
config-ui/src/components/pagination/styled.ts | 73 ---------------------------
3 files changed, 132 deletions(-)
diff --git a/config-ui/src/components/index.ts
b/config-ui/src/components/index.ts
index 9163673d8..e1122ffb5 100644
--- a/config-ui/src/components/index.ts
+++ b/config-ui/src/components/index.ts
@@ -25,6 +25,5 @@ export * from './logo';
export * from './message';
export * from './no-data';
export * from './page-header';
-export * from './pagination';
export * from './selector';
export * from './tooltip';
diff --git a/config-ui/src/components/pagination/index.tsx
b/config-ui/src/components/pagination/index.tsx
deleted file mode 100644
index 8bde5cf53..000000000
--- a/config-ui/src/components/pagination/index.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { Icon } from '@blueprintjs/core';
-
-import * as S from './styled';
-
-export interface PaginationProps {
- page: number;
- pageSize?: number;
- total: number;
- onChange: (page: number) => void;
-}
-
-export const Pagination = ({ page, pageSize = 20, total, onChange }:
PaginationProps) => {
- const lastPage = Math.ceil(total / pageSize);
-
- const handlePrevPage = () => {
- if (page === 1) return;
- onChange(page - 1);
- };
-
- const handleNextPage = () => {
- if (page === lastPage) return;
- onChange(page + 1);
- };
-
- return (
- <S.List>
- <S.Item disabled={page === 1} onClick={handlePrevPage}>
- <Icon icon="chevron-left" />
- </S.Item>
- {Array.from({ length: lastPage }).map((_, i) => (
- <S.Item key={i + 1} active={page === i + 1} onClick={() => onChange(i
+ 1)}>
- <span>{i + 1}</span>
- </S.Item>
- ))}
- <S.Item disabled={page === lastPage} onClick={handleNextPage}>
- <Icon icon="chevron-right" />
- </S.Item>
- </S.List>
- );
-};
diff --git a/config-ui/src/components/pagination/styled.ts
b/config-ui/src/components/pagination/styled.ts
deleted file mode 100644
index 5a810dcb1..000000000
--- a/config-ui/src/components/pagination/styled.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import styled from 'styled-components';
-
-export const List = styled.ul`
- display: flex;
- align-items: center;
- justify-content: flex-end;
- margin-top: 16px;
-`;
-
-export const Item = styled.li<{ active?: boolean; disabled?: boolean }>`
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 8px;
- width: 30px;
- height: 30px;
- color: #7497f7;
- border: 1px solid #7497f7;
- border-radius: 4px;
- cursor: pointer;
- transition: all 0.3s ease-in-out;
-
- &:hover {
- color: #fff;
- background-color: #7497f7;
- }
-
- ${({ active }) =>
- active
- ? `
- color: #fff;
- background-color: #7497f7;
- cursor: no-drop;
- `
- : ''}
-
- ${({ disabled }) =>
- disabled
- ? `
- color: #a1a1a1;
- border-color: #a1a1a1;
- cursor: no-drop;
-
- &:hover {
- color: #a1a1a1;
- border-color: #a1a1a1;
- background-color: transparent;
- }
- `
- : ''}
-
- &:last-child {
- margin-right: 0;
- }
-`;