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
web: add custom navbar button support #4723
Conversation
I'm going to be honest, I am not a wizard with I basically had to convert a couple places to mix-ins so that I could re-use them across styled components. I also made the If this is all totally wrong/insane and there's a better way to do things, let me know and I can happily re-work this PR! |
<InstrumentedButton | ||
analyticsName={"ui.web.uibutton"} | ||
onClick={onClick} | ||
disabled={loading} |
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 wonder if it makes sense to always disable the button if pathBuilder.isSnapshot(), so the button doesn't do anything in snapshots
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 am...slightly worried about the multi-dimensional venn diagram of mixins. I'm not sure I have a better suggestion right now.
My instinct is that React component composition is great for expressing UI hierarchy (i.e., box A visually contains box B).
We probably shouldn't be using it for multiple-inheritance of functionality and data-flow (in particular, ApiButton and InstrumentedButton are examples of this pattern).
but that pattern wasn't introduced in this PR, so i think it's fine to punt on this for now and Han + Lizz + I can talk more about it next week
Yeah, that was precisely my concern - in no world is this sane, but I wasn't sure of a good alternative that wouldn't spiral scope. My only other thought was not share components at all but have some sort of |
5e1fe28
to
fd6903a
Compare
* Optional `icon` field - will be primary for navbar buttons with `text` as hover; for resource icons, will be alongside * New constant for component type: `Global` (expected component ID for navbar will be `nav`)
fd6903a
to
6bd0a32
Compare
b69461a
to
03e3ce7
Compare
|
Actually, hold on - I'll back out those changes from this PR and open a separate PR with just SVG support 😬 |
Render `Global:nav` buttons in the global nav. User-defined buttons show up first, then the built-ins (Tilt version, snapshot, help, account). The backend enforces that `Global:nav` buttons have an icon defined, though there is no practical way on either backend or frontend to determine that the icon name is valid; if it's not a real material icon, you'll get a blank space, so it should be fairly straightforward to debug regardless. Log output (via backend) ends up in the `(global)` span viewable by "All Resources" in the web interface.
03e3ce7
to
5bc1ea9
Compare
Sorry for Git chaos here, just wanted to unbundle the changes - this is now the same as when originally approved minus dealing with codegen merge conflicts. See #4725 for SVG support. |
Render
Global:nav
buttons in the global nav. User-defined buttonsshow up first, then the built-ins (Tilt version, snapshot, help,
account).
The backend enforces that
Global:nav
buttons have an icon defined,though there is no practical way on either backend or frontend to
determine that the icon name is valid; if it's not a real material
icon, you'll get a blank space, so it should be fairly straightforward
to debug regardless.
Log output (via backend) ends up in the
(global)
span viewable by"All Resources" in the web interface.