-
Notifications
You must be signed in to change notification settings - Fork 47
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
Release v2-testnet-4.0.3 #1803
Release v2-testnet-4.0.3 #1803
Changes from all commits
c441959
26273b2
b3bd4b7
0541466
56cc34a
1fef8b1
77a87a2
9eb9a66
7a27eed
6a47551
6ccef13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||
import React from "react"; | ||||||||||||||||||||||||||||||||||
import ReactDOM from "react-dom"; | ||||||||||||||||||||||||||||||||||
import styled from "styled-components"; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
const PortalContainer = styled.div` | ||||||||||||||||||||||||||||||||||
position: fixed; | ||||||||||||||||||||||||||||||||||
top: 0; | ||||||||||||||||||||||||||||||||||
left: 0; | ||||||||||||||||||||||||||||||||||
z-index: 9999; | ||||||||||||||||||||||||||||||||||
width: 100%; | ||||||||||||||||||||||||||||||||||
height: 100%; | ||||||||||||||||||||||||||||||||||
`; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
const OverlayPortal: React.FC<{ children: React.ReactNode }> = ({ children }) => { | ||||||||||||||||||||||||||||||||||
return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, document.body); | ||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||
Comment on lines
+14
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add cleanup handling for portal. Consider adding cleanup handling using useEffect to prevent potential memory leaks. const OverlayPortal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
- return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, document.body);
+ const portalRoot = document.body;
+ const el = document.createElement('div');
+
+ React.useEffect(() => {
+ portalRoot.appendChild(el);
+ return () => {
+ portalRoot.removeChild(el);
+ };
+ }, []);
+
+ return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, el);
}; 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
export default OverlayPortal; |
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.
🛠️ Refactor suggestion
Consider semantic HTML implications
Changing from
h3
tosmall
reduces the semantic importance of the "Voting Options" header. Consider using a proper heading element with styled size instead to maintain semantic structure.📝 Committable suggestion