-
Notifications
You must be signed in to change notification settings - Fork 14
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
Refacto details top icons #1304
Conversation
dtrucs
commented
Nov 14, 2024
- Reduce the markup
- Add explicit label to button/link (a11y purpose)
cd14a6e
to
9b59d56
Compare
</DetailsButton> | ||
</ToolTip> | ||
)} | ||
{displayReport && Number(details.id) && getGlobalConfig().enableReport && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{displayReport && Number(details.id) && getGlobalConfig().enableReport && ( | |
{displayReport && Boolean(Number(details.id)) && getGlobalConfig().enableReport && ( |
(or it will display 0
in DOM if Number(details.id)
is 0
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe:
{displayReport && Number(details.id) && getGlobalConfig().enableReport && ( | |
{Boolean(displayReport && Number(details.id) && getGlobalConfig().enableReport) && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or event better: preparing a variable like
const showMyContent = Boolean(displayReport && Number(details.id) && getGlobalConfig().enableReport);
then:
{displayReport && Number(details.id) && getGlobalConfig().enableReport && ( | |
{showMyContent && ( |
{displayReservationWidget && | ||
(details as Details).reservation && | ||
(details as Details).reservation_id && | ||
getGlobalConfig().reservationPartner && | ||
getGlobalConfig().reservationProject && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous one: should be better with a tailored variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right for a better readability, i just pushed a commit with all suggestions 👍
(Cast the detail.id to number was useless and 0 value should not exist)
Co-authored-by: mab <benjamin.marguin@makina-corpus.com>
9b59d56
to
f4cf9d4
Compare