-
Notifications
You must be signed in to change notification settings - Fork 356
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
Carbon 10 navbar & menu #6963
Carbon 10 navbar & menu #6963
Conversation
Cc @skateman As far as I know, the only thing I need to fix is So, feel free to review :) |
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 have two major readability concerns:
- mixing too much conditional logic into the body of the return()
- forcing multiline/indented markup for one/two props on a single element
@@ -45,14 +46,17 @@ const renderItems = ({ items, controllerName }) => { | |||
}; | |||
|
|||
const Breadcrumbs = ({ items, title, controllerName }) => ( |
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 woudln't call it just Breadcrumbs
if we also put the notifications into it.
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.
left Breadcrumbs toggle-less and added BreadcrumbsBar to wrap both 👍
return ( | ||
<a | ||
id="notifications-toggle" | ||
className={`btn btn-default ${isDrawerVisible && 'active'} ${unreadCount && 'unread'}`} |
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.
You can use classNames
here.
onClick={toggle} | ||
> | ||
{__("Notifications")} | ||
|
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.
eh
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.
looks like {' '}
is more standard, updating
@@ -0,0 +1,33 @@ | |||
## ManageIQ Main Menu & Navbar |
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.
Shouldn't be this part of guides instead?
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'm hoping the closer to the code this is, the bigger the chance people will maintain it
¯\_(ツ)_/¯
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'm just worried about fragmentation of our docs.
const { miqChangeGroup } = window; | ||
|
||
export const GroupSwitcher = ({ miqGroups, currentGroup, expanded }) => { | ||
const options = miqGroups.map((g) => ({ |
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.
What about destructuring, then you don't need the g and this can be a one-liner.
app/javascript/menu/main-menu.jsx
Outdated
|
||
<hr className="bx--side-nav__hr" /> | ||
|
||
{searchResults && <SearchResults |
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.
Same here, a one-liner is more readable.
<p className="menu-search-title"> | ||
{titles[titles.length - 1]} | ||
</p> | ||
<p className="menu-search-parent"> |
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.
This is super hard to follow below 😕
const Count = ({ length }) => ( | ||
<p> | ||
{__("Results")} | ||
|
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.
eh
app/javascript/menu/second-level.jsx
Outdated
import { itemId, linkProps } from './item-type'; | ||
|
||
const mapItems = (items) => items.map((item) => ( | ||
item.items.length |
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.
What about pulling out the component selection logic outside from the render?
const Component = item.items.length ? MenuSection : MenuItem;
return <Component key={item.id} {...item} />
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.
first level section/item take different props
EDIT: simplified
Added support for hiding secondary menu after clicking a menu item (about modal & react routes don't do full page reload), |
basically v2v support, but it will work for any plugin which uses `.menu` and `HashRouter` would need different, simpler `currentUrl` logic for `BrowserRouter`
Ok, this also supports v2v menu items now by watching for history changes, ManageIQ/manageiq-v2v#1136 removes the obsolete v2v code. |
@miq-bot remove_label wip |
Checked commits https://github.com/himdel/manageiq-ui-classic/compare/0a389463f4b89ca3744d9c6be402c5c87c6b1710~...e2aab9644e41dc759d64fb706e7d8f7a2e3ea558 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint app/presenters/menu/default_menu.rb
app/presenters/menu/manager.rb
app/views/layouts/_breadcrumbs.html.haml
app/views/layouts/_header.html.haml
|
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.
LGTM 👍 @h-kataria can you please also click through this a little bit? |
Tried in UI, Looks good. |
Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: ManageIQ#6963
NOTE: Pulling this in from another branch, but is already part of a separate PR. Just doing to help make CI "less red" Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: ManageIQ#6963
NOTE: Pulling this in from another branch, but is already part of a separate PR. Just doing to help make CI "less red" Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: ManageIQ#6963
NOTE: Pulling this in from another branch, but is already part of a separate PR. Just doing to help make CI "less red" Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: ManageIQ#6963
Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: ManageIQ#6963
Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: ManageIQ#6963
NOTE: Pulling this in from another branch, but is already part of a separate PR. Just doing to help make CI "less red" Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: ManageIQ#6963
Fixes #6817
Fixes #6986
Related PRs (all dependencies merged now):
This PR replaces our menu & navbar with a carbon menu design (#6986), without a navbar,
switches menu (and notification button) to carbon icons,
moves the notification button to the breadcrumb area,
merges the help menu section, user settings and server configuration under one Settings menu,
adds 2 new (non-customizable) logos:
manageiq-logo-inverse.svg
&manageiq-logo-glyph-inverse.svg
(collapsed) for the menu (and minifiesbrand.svg
),moves all menu, navbar & notifications styling to webpack (and removes obsolete entries),
and makes react router router changes (currently only used by v2v) work out of the box by watching for route changes.
Registered components:
menu.MainMenu
- the menumenu.Navbar
- an empty navbar stubRelevant Carbon docs:
menu - UIShell
react - storybook
theme - Gray 90 is the menu theme