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

Mobile menu style fixes #602

Closed
wants to merge 7 commits into from

Conversation

johnkuney
Copy link
Contributor

No description provided.

@@ -151,6 +151,30 @@ const Header = () => {

const theme = data.site.siteMetadata.themeColours

function MobileDropdown({ children, links, navLinkClass }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why introduce a copy of the existing MobileDropdown instead of fixing the existing one? As far as I can tell, the one in components/dropdownButtons/dropdown is no longer used now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For sure, cleaned that up. I moved it to the header so I could trigger the collapse state of the whole menu when language is selected. Otherwise could only close the language menu

Copy link
Contributor

Choose a reason for hiding this comment

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

The fact you need to track the dropdown state in the header rather than the dropdown is a good indication that there is already too much in the header. You are making the problem worse.

Ultimately, why is this the header's job to know if the dropdown is mobile or not or what? The header ask for a dropdown, it's up to the drop down component to sort this mess out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good points. I've refactored a bit and separated the components

@@ -151,6 +151,30 @@ const Header = () => {

const theme = data.site.siteMetadata.themeColours

function MobileDropdown({ children, links, navLinkClass }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The fact you need to track the dropdown state in the header rather than the dropdown is a good indication that there is already too much in the header. You are making the problem worse.

Ultimately, why is this the header's job to know if the dropdown is mobile or not or what? The header ask for a dropdown, it's up to the drop down component to sort this mess out.

refactored the nav components to be more independent from the header/cleaner
const [currentUSDPrice, setCurrentUSDPrice] = useState("-")
const updateBchPrice = () => {
axios.get(bchPriceApi).then(response => {
if (response.data && response.data.USD) {
setCurrentUSDPrice(response.data.USD)
setCurrentUSDPrice(response.data.USD.toFixed(2))
Copy link
Contributor

Choose a reason for hiding this comment

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

This has nothing to do with the patch at hand.

)}
</div>
<NavItems navBarItems={navBarItems} />
<MobileNavItems navBarItems={navBarItems} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Either this is some kind of generic component that generate a navbar, in which case it's hard to justify this components having to deal with the fact that navbar for mobile or desktop des things differently, or it is not generic, and then it is hard to justify that this is the pieces of code that needs to handle what is in the navbar.

You really need to think about what is responsible of what and split things accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you help me understand this? I would say the header component is not generic. So....there shouldnt be seperate components for the NavItems and MobileNavItems? Or both of those should be directly in the header?

Copy link
Contributor

Choose a reason for hiding this comment

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

You need to decide what the responsibility of each piece of code is and split things accordingly.

Copy link
Contributor

@deadalnix deadalnix left a comment

Choose a reason for hiding this comment

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

This is now doing 20 different things at once.

This to split this up in meaningful chunks.

@johnkuney
Copy link
Contributor Author

Are you talking about this PR or the nav components?

@deadalnix
Copy link
Contributor

I'm talking about the fact that this very PR now does a ton of stuff. It can be broken down.

@johnkuney
Copy link
Contributor Author

Okay for sure. It got a bit carried away because the whole header component needed rearragning to achieve the original goal of improving mobile nav UX. I'll break it up

@deadalnix
Copy link
Contributor

Don't be worried, this is a normal part of the process. You start pulling the string, a whole ball of stuff comes with it, you deal with it. Now is the time to break it up. For instance, there are refactoring in there - changes in the structure of the code that do not change the behavior. You might want to extract these in their own patch, and then you can apply the behavioral changes on top of it.

@johnkuney
Copy link
Contributor Author

Okay broke these changes out into other PRs. I'll close this PR to avoid confusion

@johnkuney johnkuney closed this Sep 22, 2020
@shadi19838410 shadi19838410 linked an issue Mar 23, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RAY Tropics ( MD SHADI )
3 participants