-
Notifications
You must be signed in to change notification settings - Fork 15
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: user hub placement #2637
fix: user hub placement #2637
Conversation
3968f9e
to
c2d36dc
Compare
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.
Hey @joanna-pagepro 🦖
When I attempt to test this, the userhub closes the side panel and then automatically closes straight after as shown in the recording below:
c2d36dc
to
de27a70
Compare
@melyndav please review it again |
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.
Thanks for that fix @joanna-pagepro, I've been able to test it and everything is looking resolved now. nice work! 👍
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.
Cool work @joanna-pagepro ✨
I didn't manage to reproduce the issue anymore 👍 however I left some code refactoring comments
@@ -51,7 +53,12 @@ const ActionSidebarContextProvider: FC<PropsWithChildren> = ({ children }) => { | |||
|
|||
actionSidebarUseRegisterOnBeforeCloseCallback((element) => { | |||
const isClickedInside = isElementInsideModalOrPortal(element); | |||
if (!isClickedInside) { | |||
const navigationWrapper = document.querySelector('.modal-blur-navigation'); |
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.
Can we please refactor document.querySelector
in a utils function?
const getElementWithSelector = (selector) => document.querySelector(selector);
and use it here const navigationWrapper = getElementWithSelector('.modal-blur-navigation')
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.
What is the advantage of doing so?
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.
The advantage would be to abstract the way elements are selected.
In case additional logic will be needed in the future, eg. log an error if the element is not found for a specific selector, only the utility function will need to be updated.
|
||
useEffect(() => { | ||
if ( | ||
isOpen && | ||
shouldShowHeader && | ||
!document.body.classList.contains('show-header-in-modal') | ||
) { | ||
document.body.classList.add('show-header-in-modal'); | ||
} | ||
|
||
return () => { | ||
document.body.classList.remove('show-header-in-modal'); | ||
}; | ||
}, [isOpen, shouldShowHeader]); |
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.
Can we extract this in a hook?
const useAddClassToElement = ({ shouldAddClass, element, className }) => {
useEffect(() => {
if (
shouldAddClass &&
!element.classList.contains(className)
) {
element.classList.add(className);
}
return () => {
element.classList.remove(className);
};
}, [shouldAddClass, element, className]);
}
And use it here as
useAddClassToElement({
shouldAddClass: isOpen && shouldShowHeader,
className: 'show-header-in-modal',
element: document.body
})
|
||
if ( | ||
!isClickedInside || | ||
(navigationWrapper && navigationWrapper.contains(element) && !isTablet) |
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.
Can we please refactor this part navigationWrapper && navigationWrapper.contains(element)
into an utils function?
const isChildOf = (parent, child) => parent && parent.contains(child);
and use it here (isChildOf(navigationWrapper, element) && !isTablet)
className={clsx( | ||
'modal-blur-navigation [.show-header-in-modal_&]:z-[1001]', | ||
{ | ||
'relative z-[11]': !isTablet, |
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.
Is anything stopping us from using z-20
?
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.
I just think that 11 is enough here. I haven't tested it with 20
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.
Just dropping a note to say it is preferred to use the z-index values in tailwind.config.js
rather than arbitrary values.
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.
In this case, we could add these values (11 and 1001) in tailwind.config.js
if the already defined values are not usable in this scenario
de27a70
to
e397138
Compare
@mmioana can you check the changes and my answers? |
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.
Thank you @joanna-pagepro for your prompt changes! 💮
Could please tackle also the other two comments?
e397138
to
85cf431
Compare
@mmioana done |
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.
Thank you @joanna-pagepro for your work! 🚀 💟
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.
Re-approving this one @joanna-pagepro! Thanks again for your work. 🤩
Description
Fix for transaction pending button overlapping issue
Testing
Diffs
New stuff ✨
Changes 🏗
modal-blur
ormodal-blur-navigation
classesshouldShowHeader
prop is passed to theModal
componentDeletions ⚰️
TODO
Resolves #2456