Skip to content

Commit

Permalink
add columnWidths for donors list and modal
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Nov 17, 2023
1 parent 6344233 commit 2dcf1bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Donors/DonorsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getDonorsFormatter } from './utils';

export function DonorsContainer({
columnMapping,
columnWidths,
columnWidths: columnWidthsProp,
donors,
fields,
formatter,
Expand Down Expand Up @@ -62,6 +62,14 @@ export function DonorsContainer({
}
};

const columnWidths = useMemo(() => {
return columnWidthsProp || {
name: { min: 200, max: '50%' },
code: { min: 100, max: '40%' },
unassignDonor: '10%',
};
}, [columnWidthsProp]);

return (
<>
<DonorsList
Expand All @@ -80,6 +88,7 @@ export function DonorsContainer({
onAddDonors={onAddDonors}
name={id}
searchLabel={searchLabel}
columnWidths={columnWidths}
/>
)
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Donors/DonorsLookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const DonorsLookup = ({
onAddDonors,
searchLabel,
visibleColumns,
columnWidths,
}) => {
const stripes = useStripes();

Expand All @@ -43,6 +44,7 @@ export const DonorsLookup = ({
visibleFilters={visibleFilters}
isMultiSelect
sortableColumns={sortableColumns}
columnWidths={columnWidths}
>
<span data-test-add-donor>
<FormattedMessage id="stripes-acq-components.donors.noFindOrganizationPlugin" />
Expand All @@ -56,6 +58,7 @@ DonorsLookup.propTypes = {
name: PropTypes.string,
searchLabel: PropTypes.node,
visibleColumns: PropTypes.arrayOf(PropTypes.string),
columnWidths: PropTypes.object,
};

DonorsLookup.defaultProps = {
Expand Down

0 comments on commit 2dcf1bb

Please sign in to comment.