-
Notifications
You must be signed in to change notification settings - Fork 12
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
Navigation: Add component #20
Comments
FYII worked on a similar system during the creation of Help Scout's Beacon: The UI/experience is different. However, the underlying Nav-based system will almost be identical. Some points from that experience...
|
Updates! I have something working: Demo: Nested screens work, along with "active" awareness, back/forward navigation awareness + animation sync. The Navigation component code does work, however, I would not be comfortable using it outside of prototyping. The primary thing that needs to be fixed would be the (current) reliance on React Router Context. The current work-around to avoid app integration conflict is to use a namespace param (which isn't ideal). Anywhoo!! It looks + feels promising :) Check out the code needed to create this experience: The components + markup is simple, and should feel very familiar to those who have used React Router (or any routing library). There's room for improvement, but we should continue with this DX in mind! Things to Improve
|
Haiii! An interesting update.. I started learning me some Swift UI. Today, I learned about their Oh, my, goodness. I'm blown away with how easy Navigation is within Swift UI. Below is a simple example: NavigationView {
NavigationLink(destination: ProductsView()) {
Text("Products")
}
NavigationLink(destination: SettingsView()) {
Text("Settings")
}
...
} Animations, gestures, title transitions, back/forward history, all of that good stuff... It's all included with I hope we're able to provide a similar experience with these |
Updates!! I've created a more complex example based on this Codepen by @jameskoster: Video demo: Story link: It showcases:
Taking a look at the code: There isn't all that much happening! Most of it is UI composition. The Note: The "Back" nav link for the WooCommerce plugin is wonky as the collection of WooCommerce plugin links are dummy ones, which cause the history to be wonky. |
@psealock Thanks! Hopefully these examples can help! |
Another update! I've updated the Story with a mock browser bar to help better illustrate the integrated route state changes: https://g2-components.xyz/iframe.html?id=components-navigator--sidebar |
I'd like to offer a different perspective on the router problem that you first discussed in WordPress/gutenberg#24107 (comment):
This sounds quite similar to the rationale that lead to the development of I'd argue that if the requirements for a library are so well-defined and narrow as in the case of this router (map a route to a component hierarchy), and there exists one industry standard for it, we might as well embrace it. I think it's a bit of wishful thinking that we can become fully library-independent if we only hide it behind an abstraction layer that's effectively replicating its interface (and I can list a number of issues that we've encountered with I'd suggest we use React Router (since Reach is going to be 'merged' into it). We had some good experience with it while working on the Gutenboarding project in Calypso. I think it's even a thin enough abstraction layer that I think it can even be interoperable with other routing libraries (that serve other routes on the same server). I'm happy to elaborate more if needed 😄 cc/ @sirreal who co-championed React Router in Gutenboarding |
I'd leave a strong vote for using a library and against implementing something when an OSS library (with a compatible license) already has the features we want. The It seems to me that the only argument against using
Can we explore that space? That seems like a surmountable problem if its the only argument against react-router. |
@ockham + @sirreal Haii! Thank you for your feedback! For context, the current implementation does use React Router ✌️ . Previous to this, I had explored other Router solutions (Wouter, Reach, and others). However, React Router's feature set/flexibility made the most sense. Unfortunately, React Router's code was "forked" (copied/pasted) into G2. We can certainly explore it. I've tried 😅 . Others are free to give it a shot. React Router's components (e.g. For our purposes, I wish they were more flexible. Similar to how Reakit's components are context/state agnostic, until you pass things in: However, I do understand that this use-case is probably not common. As React Router was designed for apps (not necessarily libraries), and apps almost always use a single routing system. |
Additional ideas here: |
I got a VERY early and rough prototype of a Navigation component during early development of G2:
https://g2-components.xyz/iframe.html?id=components-navigator--default&viewMode=story#
Having a feature-rich
<Navigation />
component would be a VERY welcomed addition in the world of web components. Some features would include:(The React Native world already has this <3)
I initially wrote about the requirements, mechanics, and breakdown in detail here:
WordPress/gutenberg#24107 (comment)
Visual Prototype
An example of this experience can be seen in this CodePen (by @jameskoster)
https://cdpn.io/jameskoster/debug/vYGEEpp#
Link to Figma file:
https://www.figma.com/file/e4tLacmlPuZV47l7901FEs/WordPress-Design-Library?node-id=1456%3A72
Another Figma Prototype:
https://www.figma.com/proto/QNNc834dBBNz1bL2qc9VZyq5/Navigation-experimental?node-id=1765%3A4323&viewport=517%2C73%2C0.14826907217502594&scaling=scale-down
The text was updated successfully, but these errors were encountered: