Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Toggle Sidebar #5

Merged
merged 1 commit into from
Dec 3, 2020
Merged

Conversation

maxceem
Copy link
Contributor

@maxceem maxceem commented Nov 29, 2020

Overview

Implemented methods disableSidebarForRoute(route) and enableSidebarForRoute (route) which can disable (remove) and enable back the sidebar for some route.

For example disableSidebarForRoute('/micro-frontends-react-route/no-sidebar/*') removes sidebar for all the routes which start from /micro-frontends-react-route/no-sidebar/ and its subroutes. Internally it uses Reach Route Match Logic, see https://reach.tech/router/api/Match.

Reasoning

I suggest disabling sidebar by routes rather than having general methods like disableSidebar() and enableSideabar(). Because by using such methods it would be easy to get issues like:

  • One application disables sidebar.
  • After we load another application and sidebar is left disabled.

So we would have to always remember about this and either apps should always re-enable sidebar on unmout. Or apps that need the sidebar have to always enable sidebar on load. This is very easy to forget about this.

When we disable sidebar by the route we don't have to re-enable it. As sidebar would be removed only for matching routes.

Demo

toggle-sidebar

@maxceem maxceem requested a review from gondzo November 29, 2020 13:52
@urwithat urwithat merged commit 10b443a into topcoder-archive:dev Dec 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants