diff --git a/src/components/AddPeopleToTag/AddPeopleToTag.module.css b/src/components/AddPeopleToTag/AddPeopleToTag.module.css index fb8599d96c..945f887655 100644 --- a/src/components/AddPeopleToTag/AddPeopleToTag.module.css +++ b/src/components/AddPeopleToTag/AddPeopleToTag.module.css @@ -51,27 +51,3 @@ max-height: 350px; /* Set your desired max height */ overflow-y: auto; /* Enable vertical scrolling */ } - -/* SimpleLoader.css */ -.simple-loader { - display: flex; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.spinner { - width: 40px; - height: 40px; - border: 4px solid rgba(0, 0, 0, 0.1); - border-top-color: #3498db; - border-radius: 50%; - animation: spin 0.6s linear infinite; -} - -@keyframes spin { - to { - transform: rotate(360deg); - } -} diff --git a/src/components/AddPeopleToTag/AddPeopleToTag.tsx b/src/components/AddPeopleToTag/AddPeopleToTag.tsx index e04c757993..95447fc196 100644 --- a/src/components/AddPeopleToTag/AddPeopleToTag.tsx +++ b/src/components/AddPeopleToTag/AddPeopleToTag.tsx @@ -20,6 +20,7 @@ import { ADD_PEOPLE_TO_TAG } from 'GraphQl/Mutations/TagMutations'; import InfiniteScroll from 'react-infinite-scroll-component'; import { WarningAmberRounded } from '@mui/icons-material'; import { useTranslation } from 'react-i18next'; +import InfiniteScrollLoader from 'components/InfiniteScrollLoader/InfiniteScrollLoader'; /** * Props for the `AddPeopleToTag` component. @@ -280,7 +281,7 @@ const AddPeopleToTag: React.FC = ({ id="scrollableDiv" data-testid="scrollableDiv" style={{ - height: 300, + maxHeight: 300, overflow: 'auto', }} > @@ -291,11 +292,7 @@ const AddPeopleToTag: React.FC = ({ userTagsMembersToAssignToData?.getUserTag.usersToAssignTo .pageInfo.hasNextPage ?? false } - loader={ -
-
-
- } + loader={} scrollableTarget="scrollableDiv" > { + test('Component should be rendered properly', () => { + render(); + + expect(screen.getByTestId('infiniteScrollLoader')).toBeInTheDocument(); + expect( + screen.getByTestId('infiniteScrollLoaderSpinner'), + ).toBeInTheDocument(); + }); +}); diff --git a/src/components/InfiniteScrollLoader/InfiniteScrollLoader.tsx b/src/components/InfiniteScrollLoader/InfiniteScrollLoader.tsx new file mode 100644 index 0000000000..1554721e32 --- /dev/null +++ b/src/components/InfiniteScrollLoader/InfiniteScrollLoader.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import styles from './InfiniteScrollLoader.module.css'; + +const InfiniteScrollLoader = (): JSX.Element => { + return ( +
+
+
+ ); +}; + +export default InfiniteScrollLoader; diff --git a/src/components/TagActions/TagActions.module.css b/src/components/TagActions/TagActions.module.css index e667adb96e..d291929137 100644 --- a/src/components/TagActions/TagActions.module.css +++ b/src/components/TagActions/TagActions.module.css @@ -148,27 +148,3 @@ color: rgb(77, 76, 76); font-weight: 600; } - -/* SimpleLoader.css */ -.simpleLoader { - display: flex; - justify-content: start; - align-items: center; - width: 100%; - height: 100%; -} - -.spinner { - width: 40px; - height: 40px; - border: 4px solid var(--bs-gray); - border-top-color: var(--bs-gray); - border-radius: 50%; - animation: spin 0.6s linear infinite; -} - -@keyframes spin { - to { - transform: rotate(360deg); - } -} diff --git a/src/components/TagActions/TagActions.tsx b/src/components/TagActions/TagActions.tsx index 57ffe7268f..534d2089d5 100644 --- a/src/components/TagActions/TagActions.tsx +++ b/src/components/TagActions/TagActions.tsx @@ -24,6 +24,7 @@ import { TAGS_QUERY_PAGE_SIZE } from 'utils/organizationTagsUtils'; import InfiniteScroll from 'react-infinite-scroll-component'; import { WarningAmberRounded } from '@mui/icons-material'; import TagNode from './TagNode'; +import InfiniteScrollLoader from 'components/InfiniteScrollLoader/InfiniteScrollLoader'; interface InterfaceUserTagsAncestorData { _id: string; @@ -359,7 +360,7 @@ const TagActions: React.FC = ({ id="scrollableDiv" data-testid="scrollableDiv" style={{ - height: 300, + maxHeight: 300, overflow: 'auto', }} className={`${styles.scrContainer}`} @@ -371,11 +372,7 @@ const TagActions: React.FC = ({ orgUserTagsData?.organizations[0].userTags.pageInfo .hasNextPage ?? false } - loader={ -
-
-
- } + loader={} scrollableTarget="scrollableDiv" > {userTagsList?.map((tag) => ( diff --git a/src/components/TagActions/TagNode.tsx b/src/components/TagActions/TagNode.tsx index 0feda3799b..50b009ca83 100644 --- a/src/components/TagActions/TagNode.tsx +++ b/src/components/TagActions/TagNode.tsx @@ -9,6 +9,7 @@ import type { InterfaceOrganizationSubTagsQuery } from 'utils/organizationTagsUt import { TAGS_QUERY_PAGE_SIZE } from 'utils/organizationTagsUtils'; import styles from './TagActions.module.css'; import InfiniteScroll from 'react-infinite-scroll-component'; +import InfiniteScrollLoader from 'components/InfiniteScrollLoader/InfiniteScrollLoader'; interface InterfaceTagNodeProps { tag: InterfaceTagData; @@ -141,7 +142,7 @@ const TagNode: React.FC = ({ id={`subTagsScrollableDiv${tag._id}`} data-testid={`subTagsScrollableDiv${tag._id}`} style={{ - height: 300, + maxHeight: 300, overflow: 'auto', }} className={`${styles.scrContainer}`} @@ -152,11 +153,7 @@ const TagNode: React.FC = ({ hasMore={ subTagsData?.getUserTag.childTags.pageInfo.hasNextPage ?? false } - loader={ -
-
-
- } + loader={} scrollableTarget={`subTagsScrollableDiv${tag._id}`} > {subTagsList.map((tag: InterfaceTagData) => ( diff --git a/src/screens/ManageTag/ManageTag.module.css b/src/screens/ManageTag/ManageTag.module.css index 191d74c048..4607f774cc 100644 --- a/src/screens/ManageTag/ManageTag.module.css +++ b/src/screens/ManageTag/ManageTag.module.css @@ -122,6 +122,6 @@ scrollbar-width: auto; scrollbar-color: var(--bs-gray-400) var(--bs-white); - height: calc(100vh - 18rem); + max-height: calc(100vh - 18rem); overflow: auto; } diff --git a/src/screens/ManageTag/ManageTag.tsx b/src/screens/ManageTag/ManageTag.tsx index 3e210b45af..c1d8a6686c 100644 --- a/src/screens/ManageTag/ManageTag.tsx +++ b/src/screens/ManageTag/ManageTag.tsx @@ -38,6 +38,7 @@ import { import AddPeopleToTag from 'components/AddPeopleToTag/AddPeopleToTag'; import TagActions from 'components/TagActions/TagActions'; import InfiniteScroll from 'react-infinite-scroll-component'; +import InfiniteScrollLoader from 'components/InfiniteScrollLoader/InfiniteScrollLoader'; /** * Component that renders the Manage Tag screen when the app navigates to '/orgtags/:orgId/managetag/:tagId'. @@ -461,11 +462,7 @@ function ManageTag(): JSX.Element { userTagAssignedMembersData?.getUserTag.usersAssignedTo .pageInfo.hasNextPage ?? false } - loader={ -
-
-
- } + loader={} scrollableTarget="manageTagScrollableDiv" > -
-
- } + loader={} scrollableTarget="orgUserTagsScrollableDiv" > -
-
- } + loader={} scrollableTarget="subTagsScrollableDiv" >