-
Notifications
You must be signed in to change notification settings - Fork 101
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
Header/Menu improvement #607
Conversation
CLA Assistant Lite: I have read the CLA Document and I hereby sign the CLA You can retrigger the CLA Action by commenting recheckcla in this Pull Request |
|
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.
* Move onclick for balance + wallet * Improve header 3 (#605) * Rename /profile to /account * Improve header 4 (#604) * Switch to custom MenuDropdown compontent and create a POC. * Improve header 5 (#603) * Improve FAQ text * Improve header 6 (#602) * connect button styling * Further flyout menu styling * Improve header 7 (#601) * Further flyout menu styling * Uniform menu items styling * Move styled components to styled * Add hamburger icon with animation component. * Improve header 8 (#600) * Add mediaQuery hook * Improve header 9 (#599) * Progress mobile responsive menu * Progress mobile responsive menu * Improve header 10 (#598) * Move to helper function * Optimise menu code * Improve header 11 (#597) * Move URLS to an ENUM * Fix enum issue. * Styling and route fixes. * Styling. * Styling. * Header/Menu improvement (waterfall PR FINAL) (#596) * Styling. * Styling footer and bridge banner. * Improve header 13 (#610) * Fix network selector position. * Fix exports/imports for network selector. * Only open ordersPanel if account is true.
import styled, { css } from 'styled-components/macro' | ||
|
||
const Wrapper = styled.div<{ isMobileMenuOpen: boolean; height?: number; width?: number; lineSize?: number }>` | ||
z-index: 102; |
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.
102 😬😬😬
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.
Yeah I know...I'd want to tackle the z-index thing in a separate PR. I think moving it to a const file, and then defining some general levels would be better.
margin: 0 6px 0 16px; | ||
position: relative; | ||
width: ${({ width }) => (width ? width + 'px' : '34px')}; | ||
height: ${({ height }) => (height ? height + 'px' : '18px')}; |
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 these kinds of props i prefer setting the default in the function param destructuring like:
width: ${({ width = 18 }) => `${width}px`};
It just looks cleaner and is less code
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.
Ah nice, of course this is way cleaner setting the default like that!
span { | ||
background-color: ${({ theme }) => theme.text1}; | ||
border-radius: 3px; | ||
height: ${({ lineSize }) => (lineSize ? lineSize + 'px' : '2px')}; |
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 won't mention all of these instances but could also be replaced here
|
||
export default function MobileMenuIcon({ isMobileMenuOpen, width, height, lineSize, onClick }: IconProps) { | ||
return ( | ||
<Wrapper isMobileMenuOpen={isMobileMenuOpen} width={width} height={height} lineSize={lineSize} onClick={onClick}> |
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.
Since all the prop names are the same you can just not destructure the props in the function signature and pass them to the component like <Component {...params} />
export function Menu({ title, children }: MenuProps) { | ||
const isUpToLarge = useMediaQuery(upToLarge) | ||
const [showMenu, setShowMenu] = useState(false) | ||
const handleOnClick = () => isUpToLarge && setShowMenu(!showMenu) |
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.
SetStates allow passing a callback as a param so it's safer to do:
setShowMenu(menuState => !menuState)
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.
Like this ?
const handleOnClick = () => isUpToLarge && setShowMenu((showMenu) => !showMenu)
Why is it safer?
@@ -0,0 +1,24 @@ | |||
// ENUM with routes |
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.
Woo nice good call!
src/custom/utils/toggleBodyClass.ts
Outdated
@@ -0,0 +1,7 @@ | |||
export const toggleBodyClass = (className: string, isAdd: boolean) => { |
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.
toggle in the name implies inverting the current state so the isAdd
param is redundant
this function can just be written as
export const toggleBodyClass = (className: string) => {
if (!document.body.classList.contains(className)) {
document.body.classList.add(className)
} else {
document.body.classList.remove(className)
}
}
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.
Makes sense yes. Actually I created also specific addBodyClass and removeBodyClass util functions, as that seems sometimes more convenient.
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.
approving with minor comments
* Updating util function * change onClick onTouchStart
Hey @fairlighteth , great job! Some issues I faced during testing:
3 FAQ overview link is always highlighted, even if another section is selected
menu.mp4
Thanks! |
2 and 3: Addressed this and point 1 now to better handle this.
Addressed these in #650 |
|
@fairlighteth , refreshing does not help :( |
* Fix iOS scrolling attempt and improve events * Fix iOS scrolling attempt and improve events
* Resolve FAQ exact links and styling submenu. * Unify FAQ menu links by importing them. * close dropdowns on click and on click outside.
* Re-position Appzi modal on mobile. * FAQ adjust modal * FAQ adjust modal * try catching Appzi root ID. * try catching Appzi root ID. * try catching Appzi root ID. * try catching Appzi root ID. * try catching Appzi root ID. * fix account margin * uncomment * simple overrides * restore original code
Hey @fairlighteth , all issues are mostly fixed! Could you please take a look at it? Thanks! |
@elena-zh Thanks for checking again. The borders were intentionally removed to allow for more horizontal space. By doing that, the container/content area has more available width to display content/numbers. |
@fairlighteth , got it, thanks! |
@elena-zh Actually I would leave that one in place. |
@fairlighteth , I have created: Btw, I'm still not sure if it is OK that we have a white boarder for the Connect button in the light mode? Btw, where is Terms and Conditions page now? Thanks |
|
Hey @fairlighteth ,
Besides, I still vote for fixing #669 in the near future. But for now, the current PR is approved. Thanks! |
Summary