Skip to content

Commit 14ba17c

Browse files
authored
Merge branch 'v4' into feature/pre-commit-hook
2 parents 5b27228 + 23fe2d6 commit 14ba17c

6 files changed

Lines changed: 68 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "glints-aries",
3-
"version": "4.0.197",
3+
"version": "4.0.198",
44
"description": "Glints ui-kit for frontend",
55
"main": "./lib/index.js",
66
"module": "./es/index.js",

src/@next/IndexTable/IndexTable.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@ import React from 'react';
22
import {
33
Cell,
44
IndexTable as PolarisIndexTable,
5-
IndexTableProps,
5+
IndexTableProps as PolarisIndexTableProps,
66
} from 'polaris-glints';
77
import { Checkbox } from '../Checkbox';
88
import { CheckboxProps } from '../Checkbox';
99
import { Row } from './components/Row/Row';
1010
import { StyledIndexTable } from './IndexTableStyle';
11+
import { LoadingState } from './components/LoadingState';
12+
13+
type IndexTableProps = Omit<PolarisIndexTableProps, 'emptySearchTitle'>;
1114

1215
const IndexTable = ({
1316
bulkActions,
1417
children,
1518
itemCount,
1619
selectedItemsCount,
20+
loading,
21+
emptyState,
1722
...props
1823
}: IndexTableProps) => {
1924
const renderCheckboxHeader = ({
@@ -37,8 +42,20 @@ const IndexTable = ({
3742
<PolarisIndexTable
3843
bulkActions={bulkActions}
3944
checkbox={renderCheckboxHeader}
40-
itemCount={itemCount}
45+
itemCount={loading ? 0 : itemCount}
4146
selectedItemsCount={selectedItemsCount}
47+
emptySearchTitle={null}
48+
loading={false}
49+
emptyState={
50+
loading ? (
51+
<LoadingState
52+
label={props.loadingLabel}
53+
colSpan={props.headings.length}
54+
/>
55+
) : (
56+
emptyState
57+
)
58+
}
4259
{...props}
4360
>
4461
{children}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import { Spinner } from '../../../Spinner';
3+
import { Blue, Neutral } from '../../../utilities/colors';
4+
import { LoadingStateContainer, SpinnerContainer } from './LoadingStateStyle';
5+
import { Typography } from '../../../Typography';
6+
7+
interface LoadingStateProps {
8+
colSpan: number;
9+
label?: string;
10+
}
11+
12+
export const LoadingState = ({ colSpan, label }: LoadingStateProps) => (
13+
<LoadingStateContainer colSpan={colSpan + 1}>
14+
<SpinnerContainer>
15+
<Spinner height={48} width={48} fill={Blue.S99} />
16+
<Typography variant="subtitle1" color={Neutral.B18}>
17+
{label}
18+
</Typography>
19+
</SpinnerContainer>
20+
</LoadingStateContainer>
21+
);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import styled from 'styled-components';
2+
import { Breakpoints } from '../../..';
3+
4+
export const LoadingStateContainer = styled.td`
5+
height: 480px;
6+
`;
7+
8+
export const SpinnerContainer = styled.div`
9+
display: flex;
10+
justify-content: center;
11+
align-items: center;
12+
width: 100%;
13+
height: 100%;
14+
flex-direction: column;
15+
gap: 16px;
16+
17+
p {
18+
margin: 0;
19+
}
20+
21+
@media (max-width: ${Breakpoints.large}) {
22+
position: absolute;
23+
top: 0;
24+
left: 0;
25+
}
26+
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './LoadingState';
-53.3 KB
Loading

0 commit comments

Comments
 (0)