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

Add Navigation component #767

Merged
merged 4 commits into from
May 17, 2022
Merged

Conversation

huwshimi
Copy link
Collaborator

@huwshimi huwshimi commented Apr 22, 2022

Done

QA

Storybook

To see rendered examples of all react-components, run:

yarn start

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • Go to the navigation page in Storybook and check that the docs make sense and the examples work as expected.

Fixes

Fixes: #134.

@webteam-app
Copy link

Demo starting at https://react-components-767.demos.haus

@bartaz
Copy link
Member

bartaz commented Apr 22, 2022

@huwshimi great, thanks.

Just wondering - we haven't seem to need this component in React in any project, MAAS is the only one I guess. And now it seems that there is work planned on moving to new layout for MAAS, so even MAAS won't need this navigation in React, right?

So, I'm just wondering if it's worth migrating it and maintaining here in React components?

@huwshimi
Copy link
Collaborator Author

I think it'd be useful to have in react-components for any project adopting React. It's been quite painful to maintain the header in MAAS over the years because we were never quite aligned with Vanilla (or didn't keep up with the latest Vanilla markup).

I'd say any new project would find it quite a barrier to have to implement this themselves and sounds like there are other projects that could use this: #134 (comment).

I do understand that this will be less useful to MAAS within the next year or so when we adopt the new layout, but that could be quite a while off still.

@bartaz
Copy link
Member

bartaz commented Apr 26, 2022

I think it'd be useful to have in react-components for any project adopting React. It's been quite painful to maintain the header in MAAS over the years because we were never quite aligned with Vanilla (or didn't keep up with the latest Vanilla markup).

@huwshimi Sure, thanks for more context. I have it in my review queue.

@petermakowski
Copy link
Contributor

I opened a PR with some changes to this component in maas-ui: canonical/maas-ui#3908. If that looks ok to you, would be good to include them here before merge @huwshimi

@petermakowski
Copy link
Contributor

@huwshimi I noticed that the mobile nav background doesn't match that of vanilla.

image

@huwshimi
Copy link
Collaborator Author

@huwshimi I noticed that the mobile nav background doesn't match that of vanilla.

image

It turns out this is an inconsistency in Vanilla. I've filed an issue: canonical/vanilla-framework#4461.

@huwshimi
Copy link
Collaborator Author

I opened a PR with some changes to this component in maas-ui: canonical-web-and-design/maas-ui#3908. If that looks ok to you, would be good to include them here before merge @huwshimi

Thanks, I've updated this PR with those changes.

@petermakowski
Copy link
Contributor

Not sure if this was like that last time I reviewed, but dropdown items on mobile look broken (do not extend to full width).

This implementation

https://react-components-767.demos.haus/?path=/story/navigation--dropdown

image

Vanilla example

https://vanillaframework.io/docs/patterns/navigation#dropdown
image

@petermakowski
Copy link
Contributor

@huwshimi I noticed that the mobile nav background doesn't match that of vanilla.
image

It turns out this is an inconsistency in Vanilla. I've filed an issue: canonical-web-and-design/vanilla-framework#4461.

I couldn't find a single mention of the .has-menu-open class in vanilla documentation. 🤔 Might we be using something that's deprecated here?

@bartaz
Copy link
Member

bartaz commented May 16, 2022

I couldn't find a single mention of the .has-menu-open class in vanilla documentation. 🤔 Might we be using something that's deprecated here?

It was recently introduced with updates to new logo branding and other navigation changes. This class is added by JS when a menu is opened on mobile: https://vanillaframework.io/docs/examples/patterns/navigation/search-dark

It's possible that not all examples have it. It's only required when you have search in the navigation.

But I guess we should have made this more clear in the docs. Or at least provide class reference for the top nav component.

@huwshimi
Copy link
Collaborator Author

huwshimi commented May 17, 2022

@huwshimi I noticed that the mobile nav background doesn't match that of vanilla.
image

It turns out this is an inconsistency in Vanilla. I've filed an issue: canonical-web-and-design/vanilla-framework#4461.

I couldn't find a single mention of the .has-menu-open class in vanilla documentation. 🤔 Might we be using something that's deprecated here?

If you scroll down to the Expanding search box example you can see the grey background: https://vanillaframework.io/docs/patterns/navigation#expanding-search-box

Edit: you need to change the toggle to JS to see how "has-menu-open" is used.

@huwshimi
Copy link
Collaborator Author

Not sure if this was like that last time I reviewed, but dropdown items on mobile look broken (do not extend to full width).

That should be fixed with the next Vanilla release: canonical/vanilla-framework#4444.

Not sure if that means we should hold off landing this until it's not broken.

@bartaz
Copy link
Member

bartaz commented May 17, 2022

Not sure if this was like that last time I reviewed, but dropdown items on mobile look broken (do not extend to full width).

That should be fixed with the next Vanilla release: canonical-web-and-design/vanilla-framework#4444.

Not sure if that means we should hold off landing this until it's not broken.

It's practically ready to release, I'll try to publish it today.

@petermakowski
Copy link
Contributor

petermakowski commented May 17, 2022

Not sure if this was like that last time I reviewed, but dropdown items on mobile look broken (do not extend to full width).

That should be fixed with the next Vanilla release: canonical-web-and-design/vanilla-framework#4444.

Not sure if that means we should hold off landing this until it's not broken.

The new vanilla has been released and merged to main and the issue with the buttons width I mentioned is fixed after updating this branch with main. This should be good to merge now.

image

@petermakowski petermakowski merged commit df5bd26 into canonical:main May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build Navigation component
4 participants