Skip to content

Commit

Permalink
Update ResourceDetails component prop name
Browse files Browse the repository at this point in the history
  • Loading branch information
ciremusyoka committed May 8, 2024
1 parent e77a508 commit 075bfd6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const LocationDetails = ({ location }: { location: ILocation }) => {
<ResourceDetails
title={name}
headerLeftData={headerLeftData}
dateData={dateCreatedKeyPairing}
headerRightData={dateCreatedKeyPairing}
headerActions={<Link to={`${URL_LOCATION_UNIT_EDIT}/${id}`}>{t('Edit details')}</Link>}
bodyData={otherDetailsMap}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ResourceDetailsProps {
title: React.ReactNode;
headerLeftData: Record<string, React.ReactNode>;
headerLeftDataClasses?: string;
dateData?: Record<string, string | undefined>;
headerRightData?: Record<string, React.ReactNode | undefined>;
headerActions?: React.ReactNode;
status?: {
title: string;
Expand All @@ -27,7 +27,7 @@ export const ResourceDetails = (props: ResourceDetailsProps) => {
const {
title,
headerLeftData,
dateData,
headerRightData,
headerActions,
bodyData,
footer,
Expand All @@ -51,9 +51,9 @@ export const ResourceDetails = (props: ResourceDetailsProps) => {

<div className="header-bottom">
<ListFlatKeyValues classnames={headerLeftDataClasses} data={headerLeftData} />
{dateData && (
{headerRightData && (
<div style={{ textAlign: 'right' }}>
<SingleKeyNestedValue theme="light" data={dateData} />
<SingleKeyNestedValue theme="light" data={headerRightData} />
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const props = {
title: 'Good Health Clinic',
headerLeftData: { ID: 123, version: 5 },
headerLeftDataClasses: 'left-data',
dateData: { 'Date created': 'Today, 9.30' },
headerRightData: { 'Date created': 'Today, 9.30' },
headerActions: <a href="/patient/edit/123">Edit details</a>,
status: {
title: 'Active',
Expand Down Expand Up @@ -41,10 +41,10 @@ test('ResourceDetails component renders correctly', () => {
'Administrative Level2',
]);

const dateElementValues = [...document.querySelectorAll('.singleKeyValue-pair__light')].map(
const headerRightData = [...document.querySelectorAll('.singleKeyValue-pair__light')].map(
(keyValue) => keyValue.textContent
);
expect(dateElementValues).toEqual(['Date createdToday, 9.30']);
expect(headerRightData).toEqual(['Date createdToday, 9.30']);

const headerLeftElementValues = [...document.querySelectorAll('.left-data')].map(
(keyValue) => keyValue.textContent
Expand Down

0 comments on commit 075bfd6

Please sign in to comment.