-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: loading indicator ui for infinite loading table (#39208)
- Loading branch information
1 parent
e71d14b
commit 261cf8b
Showing
3 changed files
with
50 additions
and
0 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
26 changes: 26 additions & 0 deletions
26
app/client/src/widgets/TableWidgetV2/component/LoadingIndicator.test.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,26 @@ | ||
import React from "react"; | ||
import "@testing-library/jest-dom"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { LoadingIndicator } from "./LoadingIndicator"; | ||
|
||
describe("LoadingIndicator", () => { | ||
it("renders a spinner and loading text", () => { | ||
render(<LoadingIndicator />); | ||
|
||
// Check if the Flex container is rendered | ||
const flexContainer = document.querySelector(".ads-v2-flex"); | ||
|
||
expect(flexContainer).toBeInTheDocument(); | ||
|
||
// Check if the spinner is rendered | ||
const spinner = document.querySelector(".ads-v2-spinner"); | ||
|
||
expect(spinner).toBeInTheDocument(); | ||
|
||
// Check if the text is displayed correctly | ||
const textElement = screen.getByText("loading records"); | ||
|
||
expect(textElement).toBeInTheDocument(); | ||
expect(textElement).toHaveClass("ads-v2-text"); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
app/client/src/widgets/TableWidgetV2/component/LoadingIndicator.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,22 @@ | ||
import { Flex, Spinner, Text } from "@appsmith/ads"; | ||
import { createMessage, TABLE_LOADING_RECORDS } from "ee/constants/messages"; | ||
import React from "react"; | ||
|
||
export const LoadingIndicator = () => ( | ||
<Flex | ||
alignItems="center" | ||
background="var(--ads-v2-color-white)" | ||
borderTop="1px solid var(--wds-color-border-onaccent)" | ||
bottom="0" | ||
gap="spaces-3" | ||
left="0" | ||
padding="spaces-3" | ||
position="sticky" | ||
right="0" | ||
> | ||
<Spinner iconProps={{ color: "var(--ads-v2-color-gray-400)" }} size="md" /> | ||
<Text color="var(--ads-v2-color-gray-400)" kind="body-s"> | ||
{createMessage(TABLE_LOADING_RECORDS)} | ||
</Text> | ||
</Flex> | ||
); |