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

(fix) 03-2588: Tweak workspace alert badge UI #1499

Merged
merged 2 commits into from
Nov 23, 2023

Conversation

jwnasambu
Copy link
Contributor

@jwnasambu jwnasambu commented Nov 23, 2023

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

I added a new class styles.interruptedTag that is conditional rendered. If formOpenInTheBackground is true, it renders a element with the class styles.interruptedTag containing an exclamation mark (With the shape of the icon being circular). If formOpenInTheBackground is false, it renders null, meaning nothing is displayed.

Screenshots

Appearance on desktop

Screenshot 2023-11-23 at 5 53 10 PM

Appearance on tablet

Screenshot 2023-11-23 at 5 53 44 PM

Related Issue

Other

@jwnasambu jwnasambu marked this pull request as draft November 23, 2023 14:12
@jwnasambu jwnasambu marked this pull request as ready for review November 23, 2023 15:25
@jwnasambu
Copy link
Contributor Author

@denniskigen Kindly feel free to have a look at my PR at your convinient time please!

@denniskigen denniskigen changed the title (fix)03-2588: Warning icon on side rail should be circular Shape (fix)03-2588: Tweak workspace alert badge UI Nov 23, 2023
@denniskigen denniskigen changed the title (fix)03-2588: Tweak workspace alert badge UI (fix) 03-2588: Tweak workspace alert badge UI Nov 23, 2023
Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

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

Thanks, @jwnasambu!

@denniskigen denniskigen merged commit a1efca3 into openmrs:main Nov 23, 2023
6 checks passed
kind="ghost"
label={label}
onClick={handler}
>
<div className={styles.elementContainer}>
{getIcon({ size: 20 })}
<span className={styles.countTag}>{formOpenInTheBackground ? '!' : tagContent}</span>
<Tags isTablet={false} />
Copy link
Member

@vasharma05 vasharma05 Dec 1, 2023

Choose a reason for hiding this comment

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

Hi @jwnasambu, as we discussed before as well, we cannot have a component inside a component. If the Tags is defined as a function, it is better to call it as {Tags()} rather than <Tags />

Please refer: https://stackoverflow.com/questions/62047511/in-react-can-i-define-a-functional-component-within-the-body-of-another-functio

CC: @denniskigen @ibacher

Copy link
Member

@ibacher ibacher Dec 1, 2023

Choose a reason for hiding this comment

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

@vasharma05 There' s no real superiority in calling {Tags()} rather than <Tags />. The accepted answer on that SO post is... not wrong, but terrible advice (and, importantly, in that one case, the component being rendered like that always produces the same mark-up; that's the whole reason it works) .

The right way to approach this is to extract Tags into it's own component (it can be defined in the same file) and pass the data it needs into the component as props. Then we're just using React as designed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants