File tree Expand file tree Collapse file tree
test/e2e/indexTable/indexTable.spec.ts-snapshots Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change @@ -2,18 +2,23 @@ import React from 'react';
22import {
33 Cell ,
44 IndexTable as PolarisIndexTable ,
5- IndexTableProps ,
5+ IndexTableProps as PolarisIndexTableProps ,
66} from 'polaris-glints' ;
77import { Checkbox } from '../Checkbox' ;
88import { CheckboxProps } from '../Checkbox' ;
99import { Row } from './components/Row/Row' ;
1010import { StyledIndexTable } from './IndexTableStyle' ;
11+ import { LoadingState } from './components/LoadingState' ;
12+
13+ type IndexTableProps = Omit < PolarisIndexTableProps , 'emptySearchTitle' > ;
1114
1215const 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 }
Original file line number Diff line number Diff line change 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+ ) ;
Original file line number Diff line number Diff line change 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+ ` ;
Original file line number Diff line number Diff line change 1+ export * from './LoadingState' ;
You can’t perform that action at this time.
0 commit comments