-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
342 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
[SelectPanel] Implement loading states |
Binary file modified
BIN
-114 Bytes
(100%)
...el-Height-Initial-with-Underflowing-Items-After-Fetch-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9 Bytes
(100%)
...derflowing-Items-After-Fetch-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+34 Bytes
(100%)
...tPanel-Height-Initial-with-Underflowing-Items-After-Fetch-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6 Bytes
(100%)
...h-Underflowing-Items-After-Fetch-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3 Bytes
(100%)
...Height-Initial-with-Underflowing-Items-After-Fetch-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3 Bytes
(100%)
...flowing-Items-After-Fetch-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-114 Bytes
(100%)
...s/SelectPanel-Height-Initial-with-Underflowing-Items-After-Fetch-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9 Bytes
(100%)
...ial-with-Underflowing-Items-After-Fetch-dark-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-114 Bytes
(100%)
...el-Height-Initial-with-Underflowing-Items-After-Fetch-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9 Bytes
(100%)
...derflowing-Items-After-Fetch-dark-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-298 Bytes
(99%)
...l-Height-Initial-with-Underflowing-Items-After-Fetch-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3 Bytes
(100%)
...erflowing-Items-After-Fetch-light-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2 Bytes
(100%)
...eight-Initial-with-Underflowing-Items-After-Fetch-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2 Bytes
(100%)
...lowing-Items-After-Fetch-light-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-298 Bytes
(99%)
.../SelectPanel-Height-Initial-with-Underflowing-Items-After-Fetch-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3 Bytes
(100%)
...al-with-Underflowing-Items-After-Fetch-light-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-298 Bytes
(99%)
...l-Height-Initial-with-Underflowing-Items-After-Fetch-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3 Bytes
(100%)
...erflowing-Items-After-Fetch-light-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
packages/react/src/FilteredActionList/FilteredActionListLoaders.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react' | ||
import Box from '../Box' | ||
import Spinner from '../Spinner' | ||
import {Stack} from '../Stack/Stack' | ||
import {SkeletonBox} from '../experimental/Skeleton/SkeletonBox' | ||
|
||
export class FilteredActionListLoadingType { | ||
public name: string | ||
public appearsInBody: boolean | ||
|
||
constructor(name: string, appearsInBody: boolean) { | ||
this.name = name | ||
this.appearsInBody = appearsInBody | ||
} | ||
} | ||
|
||
export const FilteredActionListLoadingTypes = { | ||
bodySpinner: new FilteredActionListLoadingType('body-spinner', true), | ||
bodySkeleton: new FilteredActionListLoadingType('body-skeleton', true), | ||
input: new FilteredActionListLoadingType('input', false), | ||
} | ||
|
||
const SKELETON_ROW_HEIGHT = 24 | ||
const SKELETON_MIN_ROWS = 3 | ||
|
||
export function FilteredActionListBodyLoader({ | ||
loadingType, | ||
height, | ||
}: { | ||
loadingType: FilteredActionListLoadingType | ||
height: number | ||
}): JSX.Element { | ||
switch (loadingType) { | ||
case FilteredActionListLoadingTypes.bodySpinner: | ||
return <LoadingSpinner data-testid="filtered-action-list-spinner" /> | ||
case FilteredActionListLoadingTypes.bodySkeleton: { | ||
const rows = height < SKELETON_ROW_HEIGHT ? SKELETON_MIN_ROWS : height / SKELETON_ROW_HEIGHT | ||
return <LoadingSkeleton data-testid="filtered-action-list-skeleton" rows={rows} /> | ||
} | ||
default: | ||
return <></> | ||
} | ||
} | ||
|
||
function LoadingSpinner({...props}): JSX.Element { | ||
return ( | ||
<Box p={3} flexGrow={1} sx={{alignContent: 'center', textAlign: 'center', height: '100%'}}> | ||
<Spinner {...props} /> | ||
</Box> | ||
) | ||
} | ||
|
||
function LoadingSkeleton({rows = 10, ...props}: {rows: number}): JSX.Element { | ||
return ( | ||
<Box p={2} display="flex" flexGrow={1} flexDirection="column"> | ||
<Stack id="foobarbaz" direction="vertical" justify="center" gap="condensed" {...props}> | ||
{Array.from({length: rows}, (_, i) => ( | ||
<Stack key={i} direction="horizontal" gap="condensed" align="center"> | ||
<SkeletonBox width="16px" height="16px" /> | ||
<SkeletonBox height="10px" width={`${Math.random() * 60 + 20}%`} sx={{borderRadius: '4px'}} /> | ||
</Stack> | ||
))} | ||
</Stack> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.