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

🪟🎨Main menu hover state #13762

Merged
merged 25 commits into from
Jul 19, 2022
Merged

🪟🎨Main menu hover state #13762

merged 25 commits into from
Jul 19, 2022

Conversation

teallarson
Copy link
Contributor

@teallarson teallarson commented Jun 14, 2022

What

closes #12725
Adds a hover state and adds additional functionality to the active state in the SideBar menu.

Screen Shot 2022-06-28 at 10 51 26 AM

Note: for this PR, we will not be implementing the "selected" state on the flyout menus. The flyout menus (a) currently do not expose if they are "active" and (b) are due for a revisit as a whole (accessibility and design issues). When we recompose them, we can expose whether the flyout is open or not, making the active state simpler to implement.

How

  1. Moved MenuItem to an scss class
  2. Configure logic for active/hover/parent active classes based on the NavLink's "isActive" property and the pathname of the current page (Settings being an exception).

Recommended reading order

  1. SideBar.module.scss (main version, then /project/cloud)
  2. SideBar.tsx (x2)

Testing

If you are testing this locally, it's worth noting that Cloud and OSS currently each have their own SideBar. For this PR, you will want to test each environment separately. (there is an issue to create a more centralized SideBar component but was out of scope here)

@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Jun 14, 2022
const { location } = useRouter();

const menuItemStyle = (isActive: boolean) => {
const isChild = location.pathname.split("/").length > 4 && !location.pathname.includes("settings");
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels like a very specific hack for settings. Is there any reason why we would want to exclude this behavior for settings specifically? I would prefer if we don't need to add page specific hacks here, and could instead stick with a more generic implementation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Settings doesn't have a "landing page" (/settings). I've asked Nico for some feedback there (if we'd like it to act like selected or parentSelected).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could check if the menuItem's formatted message lowercased equals the last item in the pathname? I don't think that works well with i18n though. Any page with no "landing" page would never have isChild be true... Settings is just the only one we have right now.

@teallarson teallarson changed the title Main menu hover state 🪟🎨Main menu hover state Jun 21, 2022
@teallarson teallarson marked this pull request as ready for review June 28, 2022 14:58
@teallarson teallarson requested a review from a team as a code owner June 28, 2022 14:58
Copy link
Contributor

@edmundito edmundito left a comment

Choose a reason for hiding this comment

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

Tested it locally and it looks good. Just had a note and looks like there's a merged conflict. Otherwise, approved.

airbyte-webapp/src/scss/_variables.scss Outdated Show resolved Hide resolved
@teallarson teallarson merged commit c63dbd4 into master Jul 19, 2022
@teallarson teallarson deleted the teal/main-menu-hover-state branch July 19, 2022 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Main menu Hover State
4 participants