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

feat: update expand all text on enterprise customer datatable #421

Merged
merged 1 commit into from
Sep 16, 2024
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
13 changes: 12 additions & 1 deletion src/Configuration/Customers/CustomerDataTable/CustomersPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {
useCallback,
useEffect,
} from 'react';
import PropTypes from 'prop-types';
import debounce from 'lodash.debounce';
import {
Container, DataTable, TextFilter,
Expand All @@ -20,6 +21,12 @@ import {
import LmsApiService from '../../../data/services/EnterpriseApiService';
import CustomerDetailRowSubComponent from './CustomerDetailSubComponent';

const expandAllRowsHandler = ({ getToggleAllRowsExpandedProps }) => (
<button type="button" className="btn btn-link btn-inline font-weight-bold" {...getToggleAllRowsExpandedProps()}>
View subsidies
</button>
);

const CustomersPage = () => {
const [enterpriseList, setEnterpriseList] = useState([]);
const [isLoading, setIsLoading] = useState(true);
Expand Down Expand Up @@ -67,7 +74,7 @@ const CustomersPage = () => {
columns={[
{
id: 'expander',
Header: DataTable.ExpandAll,
Header: expandAllRowsHandler,
Cell: DataTable.ExpandRow,
},
{
Expand Down Expand Up @@ -104,4 +111,8 @@ const CustomersPage = () => {
);
};

expandAllRowsHandler.propTypes = {
getToggleAllRowsExpandedProps: PropTypes.func.isRequired,
};

export default CustomersPage;
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('CustomersPage', () => {
expect(screen.getByText('SSO Check')).toBeInTheDocument();
expect(screen.getByText('API Check')).toBeInTheDocument();
});

expect(screen.getByText('View subsidies')).toBeInTheDocument();
expect(screen.getByText('Customers')).toBeInTheDocument();
expect(screen.getByText('Customer details')).toBeInTheDocument();
expect(screen.getByText('SSO')).toBeInTheDocument();
Expand Down