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

[web] Make sidebar an aside element #550

Merged
merged 6 commits into from
May 8, 2023

Conversation

dgdavid
Copy link
Contributor

@dgdavid dgdavid commented Apr 25, 2023

Problem

Until now, we thought that the Sidebar behind the hamburger menu icon would be the main Agama navigation. Thus, it was born as a Layout child nav element.

However, as the project evolves and after relocating the page related options to another place in #545, the content of the sidebar looks more a set of general/complementary links than a navigation.

Solution

To address that new reality, this PR proposes two main changes

  • To change from nav to aside element, which looks more accurate to the current Sidebar role.

    It could hold one or more nav children later if needed.

  • To relocate the Sidebar as a sibling of the Layout component instead of a child.

    At first glance, this can be confusing because we normally think everything must be wrapped inside the Layout. But this is not exactly the case. Now that the sidebar is an aside element, it will be more helpful to have it as a sibling of the content instead of a child. Think that our layout component is a bit special since it is designed to not (un)mount it in each page change. Read A better layout mechanism #216 and https://gregberge.com/blog/react-scalable-layout

Please, bear in mind that this is the proposed change for the current scenario. I.e., it could need to be re-adapted later as the project continues evolving. But fortunately it's not a risky or compromising change.

Testing

  • Adapted unit tests
  • Tested manually

Screenshots

Nothing has changed at the visual level. Just a slight difference in the shadow because previous values make too much overflow on the right side with the new flow position. Are you able to spot it? 😉

Before After
Screen Shot 2023-04-26 at 15 35 47 Screen Shot 2023-04-26 at 15 39 39

Notes

It does not affect the rendered UI. So, no entry for the changes files.

@coveralls
Copy link

coveralls commented Apr 25, 2023

Pull Request Test Coverage Report for Build 4913816372

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 74.54%

Totals Coverage Status
Change from base Build 4913227059: 0.0%
Covered Lines: 4974
Relevant Lines: 6437

💛 - Coveralls

@dgdavid dgdavid marked this pull request as ready for review April 25, 2023 14:36
@dgdavid dgdavid requested a review from imobachgs April 26, 2023 11:15
@dgdavid dgdavid marked this pull request as draft April 26, 2023 14:16
@dgdavid dgdavid removed the request for review from imobachgs April 26, 2023 14:16
@dgdavid dgdavid changed the title [web] Change where the Sidebar is mounted [web] Make sidebar a sibling of content instead of a child of layout. Apr 26, 2023
@dgdavid dgdavid changed the title [web] Make sidebar a sibling of content instead of a child of layout. [web] Make sidebar an aside element Apr 28, 2023
Base automatically changed from issues to master May 8, 2023 08:43
dgdavid added 6 commits May 8, 2023 10:49
Instead of mounting them as children.

Children prop still there because it might be helpful and it allows to
keep the Sidebar test simple.
To limit the width size at the div#root level instead of the layout.
This allows better nav positioning now that it is a sibling of the
layout and not a child.
No longer needed after dropping the "groups" of actions feature from
there.
The changes made at 0801870 have been
partially undone after checking that the idea of defining sidebar
children from outside was on purpose because it is the simplest approach
to avoid unnecessary re-renders if visibility changes. See
99df6db
The main navigation is no longer there, as we thought it would be.
Altough there still general or complementary links, we have extracted
almost all navigation links to navigate from one page to another into a
page-specific dropdown menu (see PageOptions component).

If needed, we can add `nav` children to the Sidebar later.
@dgdavid dgdavid force-pushed the change-sidebar-mount-component branch from 5c8483d to 91e9317 Compare May 8, 2023 09:52
@dgdavid dgdavid marked this pull request as ready for review May 8, 2023 09:52
Copy link
Contributor

@joseivanlopez joseivanlopez left a comment

Choose a reason for hiding this comment

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

LGTM

@joseivanlopez joseivanlopez merged commit 25b170c into master May 8, 2023
@joseivanlopez joseivanlopez deleted the change-sidebar-mount-component branch May 8, 2023 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants