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

Carbon 10 navbar & menu #6963

Merged
merged 57 commits into from
Jun 6, 2020
Merged

Carbon 10 navbar & menu #6963

merged 57 commits into from
Jun 6, 2020

Conversation

himdel
Copy link
Contributor

@himdel himdel commented Apr 8, 2020

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 minifies brand.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 menu
menu.Navbar - an empty navbar stub

Relevant Carbon docs:

menu - UIShell
react - storybook
theme - Gray 90 is the menu theme

@himdel
Copy link
Contributor Author

himdel commented Apr 9, 2020

carbon-menu

Update:
20200409134553

@himdel himdel linked an issue Apr 14, 2020 that may be closed by this pull request
@chessbyte chessbyte linked an issue Apr 14, 2020 that may be closed by this pull request
@himdel
Copy link
Contributor Author

himdel commented May 1, 2020

Current state..
now


EDIT: sizing and new icons

collapsed
expanded

@himdel
Copy link
Contributor Author

himdel commented May 4, 2020

2nd level SideNav almost ready..

2nd

@himdel
Copy link
Contributor Author

himdel commented May 22, 2020

Menu collapsed:

collapsed

Menu default, with group switcher:
groups

Menu default, with 1 group:
nogroups

Menu search results:
results

Secondary and third-level menu:
sub

@himdel
Copy link
Contributor Author

himdel commented May 29, 2020

Cc @skateman

As far as I know, the only thing I need to fix is wrap the breadcrumb spec in redux, and fix v2v active items, otherwise this is ready.

So, feel free to review :)

Copy link
Member

@skateman skateman left a 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 }) => (
Copy link
Member

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.

Copy link
Contributor Author

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'}`}
Copy link
Member

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")}
&nbsp;
Copy link
Member

Choose a reason for hiding this comment

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

eh

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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
¯\_(ツ)_/¯

Copy link
Member

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) => ({
Copy link
Member

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.


<hr className="bx--side-nav__hr" />

{searchResults && <SearchResults
Copy link
Member

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.

app/javascript/menu/main-menu.jsx Show resolved Hide resolved
<p className="menu-search-title">
{titles[titles.length - 1]}
</p>
<p className="menu-search-parent">
Copy link
Member

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")}
&nbsp;
Copy link
Member

Choose a reason for hiding this comment

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

eh

import { itemId, linkProps } from './item-type';

const mapItems = (items) => items.map((item) => (
item.items.length
Copy link
Member

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} />

Copy link
Contributor Author

@himdel himdel Jun 2, 2020

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

@himdel
Copy link
Contributor Author

himdel commented Jun 2, 2020

Added support for hiding secondary menu after clicking a menu item (about modal & react routes don't do full page reload),
and miqSparkleOn, followed by miqSparkleOff on the first react router history change

basically v2v support, but it will work for any plugin which uses `.menu` and `HashRouter`
would need different, simpler `currentUrl` logic for `BrowserRouter`
@himdel
Copy link
Contributor Author

himdel commented Jun 4, 2020

Ok, this also supports v2v menu items now by watching for history changes,
so I think this is ready ready :). Or ready for another round of bashing anyway :).

ManageIQ/manageiq-v2v#1136 removes the obsolete v2v code.

@himdel
Copy link
Contributor Author

himdel commented Jun 4, 2020

@miq-bot remove_label wip

@miq-bot miq-bot changed the title [WIP] Carbon 10 navbar & menu Carbon 10 navbar & menu Jun 4, 2020
@miq-bot miq-bot added dependencies and removed wip labels Jun 4, 2020
@miq-bot
Copy link
Member

miq-bot commented Jun 4, 2020

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
5 files checked, 11 offenses detected

app/presenters/menu/default_menu.rb

app/presenters/menu/manager.rb

app/views/layouts/_breadcrumbs.html.haml

  • ⚠️ - Line 2 - Avoid using instance variables in partials views
  • ⚠️ - Line 2 - Layout/TrailingBlankLines: Final newline missing.
  • ⚠️ - Line 2 - Style/BracesAroundHashParameters: Redundant curly braces around a hash parameter.

app/views/layouts/_header.html.haml

  • ⚠️ - Line 19 - Style/BracesAroundHashParameters: Redundant curly braces around a hash parameter.
  • ⚠️ - Line 5 - Layout/SpaceInsideHashLiteralBraces: Space inside { detected.
  • ⚠️ - Line 5 - Layout/SpaceInsideHashLiteralBraces: Space inside } detected.
  • ⚠️ - Line 5 - Lint/ShadowingOuterLocalVariable: Shadowing outer local variable - group.
  • ⚠️ - Line 8 - Style/BracesAroundHashParameters: Missing curly braces around a hash parameter.

Copy link
Member

@skateman skateman left a comment

Choose a reason for hiding this comment

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

The Seal of Approval

@skateman
Copy link
Member

skateman commented Jun 5, 2020

LGTM 👍 @h-kataria can you please also click through this a little bit?

@h-kataria
Copy link
Contributor

Tried in UI, Looks good.

@h-kataria h-kataria merged commit 3eba098 into ManageIQ:master Jun 6, 2020
@himdel himdel deleted the carbon10 branch June 7, 2020 21:10
NickLaMuro added a commit to NickLaMuro/manageiq-ui-classic that referenced this pull request Jul 10, 2020
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
@NickLaMuro NickLaMuro mentioned this pull request Jul 10, 2020
NickLaMuro added a commit to NickLaMuro/manageiq-ui-classic that referenced this pull request Jul 15, 2020
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
NickLaMuro added a commit to NickLaMuro/manageiq-ui-classic that referenced this pull request Jul 15, 2020
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
NickLaMuro added a commit to NickLaMuro/manageiq-ui-classic that referenced this pull request Jul 15, 2020
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
NickLaMuro added a commit to NickLaMuro/manageiq-ui-classic that referenced this pull request Jul 16, 2020
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
NickLaMuro added a commit to NickLaMuro/manageiq-ui-classic that referenced this pull request Jul 17, 2020
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
NickLaMuro added a commit to NickLaMuro/manageiq-ui-classic that referenced this pull request Jul 17, 2020
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
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.

ManageIQ Navigation design Apply Carbon Styling to header, navbars and menus
5 participants