Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: changes to group collapsible #1375

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions src/components/PeopleManagement/GroupCardGrid.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { CardGrid, Collapsible } from '@openedx/paragon';
import { CardGrid, Collapsible, Icon } from '@openedx/paragon';
import { ExpandLess, ExpandMore } from '@openedx/paragon/icons';

import GroupDetailCard from './GroupDetailCard';

Expand Down Expand Up @@ -30,24 +31,30 @@ const GroupCardGrid = ({ groups }) => {
))}
</CardGrid>
{overflowGroups && (
<Collapsible
styling="basic"
title={`Show all ${groups.length} groups`}
className="group-collapsible"
>
<CardGrid
columnSizes={{
xs: 6,
lg: 6,
xl: 4,
}}
hasEqualColumnHeights="true"
>
{overflowGroups.map((group) => (
<GroupDetailCard group={group} />
))}
</CardGrid>
</Collapsible>
<Collapsible.Advanced>
<Collapsible.Body>
<CardGrid
columnSizes={{
xs: 6,
lg: 6,
xl: 4,
}}
hasEqualColumnHeights="true"
>
{overflowGroups.map((group) => (
<GroupDetailCard group={group} />
))}
</CardGrid>
</Collapsible.Body>
<Collapsible.Trigger className="d-flex justify-content-end text-info">
<Collapsible.Visible whenClosed>
Show all {groups.length} groups <Icon src={ExpandMore} />
</Collapsible.Visible>
<Collapsible.Visible whenOpen>
Show less <Icon src={ExpandLess} />
</Collapsible.Visible>
</Collapsible.Trigger>
</Collapsible.Advanced>
)}
</>
);
Expand Down
6 changes: 0 additions & 6 deletions src/components/PeopleManagement/_PeopleManagement.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,3 @@
padding: .25rem 1.25rem 1.25rem 1.25rem;
}
}

.group-collapsible {
.collapsible-basic .collapsible-trigger {
justify-content: right;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ describe('<PeopleManagementPage >', () => {
expect(screen.getByText('Show all 4 groups')).toBeInTheDocument();
expect(screen.queryByText('fruity pebbles')).not.toBeInTheDocument();

const collapsible = screen.getByText('Show all 4 groups');
collapsible.click();
const closedCollapsible = screen.getByText('Show all 4 groups');
closedCollapsible.click();
await waitFor(() => {
expect(screen.getByText('fruity pebbles')).toBeInTheDocument();
});

expect(screen.queryByText('Show all 4 groups')).toBeNull();
const openCollapsible = screen.getByText('Show less');
expect(openCollapsible).toBeInTheDocument();
});
});
Loading