Skip to content

Commit

Permalink
refactor: change component name
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Nov 8, 2023
1 parent 646391c commit aa88a10
Show file tree
Hide file tree
Showing 19 changed files with 9 additions and 24 deletions.
14 changes: 4 additions & 10 deletions lib/DonorsList/DonorsForm.js → lib/Donors/Donors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ import {
Row,
} from '@folio/stripes/components';

import {
defaultColumnMapping,
defaultColumnWidths,
} from './constants';
import { defaultColumnMapping } from './constants';
import DonorsContainer from './DonorsContainer';
import { useFetchDonors } from './hooks';

function DonorsForm({ name, donorOrganizationIds, ...rest }) {
export function Donors({ name, donorOrganizationIds, ...rest }) {
const [donorIds, setDonorIds] = useState(donorOrganizationIds);
const { donors, isLoading } = useFetchDonors(donorIds);

Expand All @@ -39,7 +36,7 @@ function DonorsForm({ name, donorOrganizationIds, ...rest }) {
);
}

DonorsForm.propTypes = {
Donors.propTypes = {
columnMapping: PropTypes.object,
columnWidths: PropTypes.object,
donorOrganizationIds: PropTypes.arrayOf(PropTypes.string),
Expand All @@ -49,10 +46,7 @@ DonorsForm.propTypes = {
visibleColumns: PropTypes.arrayOf(PropTypes.string),
};

DonorsForm.defaultProps = {
Donors.defaultProps = {
donorOrganizationIds: [],
columnMapping: defaultColumnMapping,
columnWidths: defaultColumnWidths,
};

export default DonorsForm;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';

import stripesFinalForm from '@folio/stripes/final-form';

import DonorsForm from './DonorsForm';
import { Donors } from './Donors';
import { useFetchDonors } from './hooks';

jest.mock('@folio/stripes/components', () => ({
Expand All @@ -25,7 +25,7 @@ const defaultProps = {

const renderForm = (props = {}) => (
<form>
<DonorsForm
<Donors
{...defaultProps}
{...props}
/>
Expand All @@ -41,7 +41,7 @@ const renderComponent = (props = {}) => (render(
</MemoryRouter>,
));

describe('DonorsForm', () => {
describe('Donors', () => {
beforeEach(() => {
useFetchDonors.mockClear().mockReturnValue({
donors: [],
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions lib/DonorsList/DonorsList.js → lib/Donors/DonorsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { MultiColumnList } from '@folio/stripes/components';
import {
alignRowProps,
defaultColumnMapping,
defaultColumnWidths,
defaultVisibleColumns,
} from './constants';

Expand Down Expand Up @@ -41,7 +40,6 @@ DonorsList.propTypes = {

DonorsList.defaultProps = {
columnMapping: defaultColumnMapping,
columnWidths: defaultColumnWidths,
visibleColumns: defaultVisibleColumns,
};

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions lib/DonorsList/constants.js → lib/Donors/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ export const defaultColumnMapping = {
export const defaultVisibleColumns = [
'name',
'code',
'unassignDonor',
];

export const alignRowProps = { alignLastColToEnd: true };

export const defaultColumnWidths = {
name: '45%',
code: '45%',
unassignDonor: '10%',
};

export const modalLabel = <FormattedMessage id="stripes-acq-components.donors.modal.title" />;
export const resultsPaneTitle = <FormattedMessage id="stripes-acq-components.donors.modal.resultsTitle" />;

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions lib/Donors/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Donors } from './Donors';
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion lib/DonorsList/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export * from './Currency';
export * from './CurrencyExchangeRateFields';
export * from './CurrencySymbol';
export * from './DeleteHoldingsModal';
export * from './DonorsList';
export * from './Donors';
export * from './DragDropMCL';
export * from './DynamicSelection';
export * from './DynamicSelectionFilter';
Expand Down

0 comments on commit aa88a10

Please sign in to comment.