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

Encapsulate the row rendering logic in a separate component #27

Merged
merged 10 commits into from
Jan 11, 2024

Conversation

sherrif10
Copy link
Member

@sherrif10 sherrif10 commented Jan 4, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Screenshots

Related Issue

Other

I introduced CustomTableRow Component which Promotes a cleaner and more modular structure by encapsulating the row rendering logic in a CustomTableRow component.

Also i did some code refactory makes it easier to manage the changes in the structure of the table.

Though the initial approach also has an advantage in the way that it makes each table cell individually defined which makes customization little easy than this approach which is more generic. Let me know your suggestions. cc @denniskigen @pirupius @jabahum . Thanks.

Screenshot from 2024-01-10 15-02-22

@sherrif10 sherrif10 changed the title encapsulate the row rendering logic in a separate component Encapsulate the row rendering logic in a separate component Jan 4, 2024
@sherrif10 sherrif10 marked this pull request as ready for review January 4, 2024 14:01
@jabahum
Copy link
Collaborator

jabahum commented Jan 5, 2024

hey @sherrif10 do you mind fixing the build errors

@sherrif10
Copy link
Member Author

Fixed linters cc @jabahum

Copy link
Member

@pirupius pirupius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sherrif10 just one more tweak before we can get this in

Comment on lines +87 to +89
<TableCell>
<span>{formatDate(parseDate(dateActivated))}</span>
</TableCell>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add class to make the cell display date on a single line

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherrif10 and @pirupius hopefully the actions button will also be in a single line

@jabahum
Copy link
Collaborator

jabahum commented Jan 5, 2024

@sherrif10 to avoid lint errors just make sure to run yarn verify before pushing to confirm everything is fine

Comment on lines 234 to 245
.single-line-date {
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.single-line-action {
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplication. You can change the class name to something more generic and reuse it in both scenarios

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviews

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherrif10 please update the PR description with the latest screenshot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pirupius i added the lasted screen shot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherrif10 your screenshot shows the date breaking to the next line. The date should be on a single line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherrif10 You can use something like this in the class you added

white-space: nowrap;

.single-line-content {
display: inline-block;
white-space: nowrap;
Copy link
Member Author

@sherrif10 sherrif10 Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @pirupius . this should really work , not sure if there other styles that conflicting it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @pirupius , Updated the screen shot.

}

.table {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to something more intentional and also not to conflict with other usages. What do u think of changing it to .single-line-display

@@ -111,7 +111,9 @@ const LaboratoryPatientList: React.FC<LaboratoryPatientListProps> = () => {
date: {
content: (
<>
<span>{formatDate(parseDate(entry.dateActivated))}</span>
<span className={styles.table}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same change will apply here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

Copy link
Member

@pirupius pirupius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sherrif10

@pirupius pirupius merged commit 82355aa into openmrs:main Jan 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants