-
-
Notifications
You must be signed in to change notification settings - Fork 21
Improve the sidebar menu #350 #539
Improve the sidebar menu #350 #539
Conversation
|
Deploy preview for eclipsefdn-iot ready! Built with commit 82c6a69 |
|
This is what I think would be better on mobile how it looks like. |
| # url = "/community/resources" | ||
| # pre = "<i data-feather=\"folder\"></i>" | ||
| # weight = 4 | ||
|
|
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.
For the changes here,
I was confused by the previous logic that we need to create middle-layer sidebar menus twice in order to show on the page so that I made some modifications to just create once. Please also refer to the changes I made in "layouts/partials/sidebar.html".
This gives me a better understanding to create the mobile-sidebar.
layouts/partials/mobile-sidebar.html
Outdated
| <div class="container"> | ||
| <div class="row"> | ||
| <div class="col-sm-24 hidden-lg hidden-md visible-sm visible-xs"> | ||
| {{ range .Site.Menus.sidebar }} | ||
| {{$parentItem := . }} | ||
| {{ if and (.HasChildren) (eq $currentSection $parentItem.Identifier) }} | ||
| <select id="sub-menu" name="sub-menu"> | ||
| <option>Navigate to...</option> | ||
| {{ range .Children }} | ||
| {{ if and (or (eq $parentItem.Identifier $currentSection) (eq .Parent $currentSection)) (eq .HasChildren false) }} | ||
| <option value="{{ .URL }}"> | ||
| {{ .Name }} | ||
| </option> | ||
| {{ end }} | ||
| {{ if .HasChildren }} | ||
| <optgroup label="{{ .Name }}"> | ||
| {{ range .Children }} | ||
| <option value="{{ .URL }}"> {{ .Name }} </option> | ||
| {{ end }} | ||
| </optgroup> | ||
| {{ end }} | ||
|
|
||
| {{ end }} <!-- range Children end --> | ||
| </select> | ||
| {{ end }} <!-- if and (.HasChildren) (eq $currentSection $parentItem.Identifier) end --> | ||
| {{ end }} <!-- range .Site.Menus.sidebar end --> | ||
| </div> | ||
| </div> | ||
| </div> |
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.
These are a dropdown test. Just for your reference to make comparison.
layouts/partials/mobile-sidebar.html
Outdated
| <!------------------------------------------------------------------> | ||
|
|
||
| <div id="mobile-sidebar" class="container hidden-lg hidden-md visible-sm visible-xs"> | ||
| <div class="container sidebar-item related-content"> | ||
| <a href="#sidebars-contents" data-toggle="collapse" aria-expanded="false" aria-controls="sidebars-contents"> | ||
| <div class="col-xs-6"><i data-feather="plus"></i></div> | ||
| <div class="col-xs-18 sidebar-text">Related Content</div> | ||
| </a> | ||
| </div> | ||
| {{ range .Site.Menus.sidebar }} | ||
| {{$parentItem := . }} | ||
| {{ if and (.HasChildren) (eq $currentSection $parentItem.Identifier) }} | ||
| <div class="container collapse" id="sidebars-contents"> | ||
| {{ range .Children }} | ||
| {{ if and (or (eq $currentSection $parentItem.Identifier) (eq .Parent $currentSection)) (eq .HasChildren false) }} | ||
| <div class="row sidebar-item{{ if eq $currentPage.Title .Name }} active{{ end }}"> | ||
| <a href="{{ .URL }}" {{ if eq $currentPage.Title .Name }}class="active"{{ end }}> | ||
| <div class="col-xs-6">{{ .Pre }}</div> | ||
| <div class="col-xs-18 sidebar-text">{{ .Name }}</div> | ||
| </a> | ||
| </div> | ||
| {{ end }} | ||
| {{ if .HasChildren }} | ||
| <div class="row sidebar-item{{ if eq $currentPage.Title .Name }} active{{ end }}"> | ||
| <a href="#sub-children-{{ .Identifier }}" data-toggle="collapse" aria-expanded="false" aria-controls="sub-children{{ .Identifier }}" {{ if eq $currentPage.Title .Name }}class="active"{{ end }}> | ||
| <div class="col-xs-6">{{ .Pre }}</div> | ||
| <div class="col-xs-18 sidebar-text">{{ .Name }}</div> | ||
| </a> | ||
| </div> | ||
| <div class="row sidebar-sub-items collapse" id="sub-children-{{ .Identifier }}"> | ||
| {{ range .Children }} | ||
| <div class="row sidebar-sub-item{{ if eq $currentPage.Title .Name }} active{{ end }}"> | ||
| <a href="{{ .URL }}" {{ if eq $currentPage.Title .Name }}class="active"{{ end }}> | ||
| <div class="col-xs-6"></div> | ||
| <div class="col-xs-18 sidebar-text">{{ .Name }}</div> | ||
| </a> | ||
| </div> | ||
| {{ end }} <!--Children's Children end--> | ||
| </div> | ||
| {{ end }} | ||
| {{ end }} <!-- range Children end --> | ||
| </div> | ||
| {{ end }} <!-- if and (.HasChildren) (eq $currentSection $parentItem.Identifier) end --> | ||
| {{ end }} <!-- range .Site.Menus.sidebar end --> | ||
| </div> <!-- "main-sidebar" end --> |
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.
These are for Collapsible test.
| {{ end }} | ||
|
|
||
| {{ define "footer-suffix" }} | ||
| <script src="/js/index.js"></script> |
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 not sure what this index.js is, and it causes a console log err.
layouts/partials/footer_suffix.html
Outdated
| }); | ||
| })(jQuery, document); | ||
|
|
||
| jQuery(document).ready(function($){ |
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.
Not sure why you need to do this?
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 for dropdown mobile sidebar, I created 2, one is dropdown and the other is collapsible, and I will defer it to the team to choose one, and I will drop the other one.
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.
Is there a place where both options are being displayed so that we can make a decision?
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.
Yes, on IOT (all pages where sidebar exists, my mobile sidebar goes the same when it has a sidebar or not) :
https://deploy-preview-539--eclipsefdn-iot.netlify.app/community/resources/
https://deploy-preview-539--eclipsefdn-iot.netlify.app/community/
https://deploy-preview-539--eclipsefdn-iot.netlify.app/adopters/how-to-be-listed-as-an-adopter/
https://deploy-preview-539--eclipsefdn-iot.netlify.app/projects/getting-started/
on Hugo theme:
https://deploy-preview-174--eclipsefdn-hugo-solstice-theme.netlify.app/third-parent
https://deploy-preview-174--eclipsefdn-hugo-solstice-theme.netlify.app/membership/
https://deploy-preview-174--eclipsefdn-hugo-solstice-theme.netlify.app/
Thanks!
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 like the collapsable option but I think it would need a down arrow or something. It took me a minute to understand that this was the menu. Or maybe the hamburger icon. Something that would tell the users that this is a menu or that there is more options available to click.
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 decide to use a hamburger like the menu.
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.
But for resources, I'm using a pre that is the same as the normal sidebar
layouts/projects/section.html
Outdated
| <script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.js"></script> | ||
| <script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/1.4.5/numeral.min.js"></script> | ||
| <script src="/assets/js/projects.min.js"></script> | ||
| <script> |
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.
If this is something you need to do more than once, can you create a partial for 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.
Sure. I add it here because projects re-defined the footer_suffix which causes mine cannot be included.
But again, this is only for dropdown, if we decide to use dropdown, I will add it to footer.html; if we decide to use collapsible I will remove it.
| @@ -0,0 +1,82 @@ | |||
|
|
|||
| #mobile-sidebar { | |||
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.
these probably will be updated after Eric add sidebar styles into hugo theme
87ef040 to
f94ef0c
Compare
0dd94b1 to
96af601
Compare
|
A lot has changed since we started working on this... @flora8984461 What is the current status, is it ready to be reviewed and deploy, or is this still a WIP? |
96af601 to
0edf065
Compare
|
For now, I think it's ready for review, though containing similar styles as in EclipseFdn/solstice-assets#197, but we can adjust styles later once Eric finishes that branch. But we can review and make this live if all good.
|
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
…ile view, and fix projects page mobilesidebar not working Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
bfb8706 to
ced775e
Compare
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
Signed-off-by: Yi Liu <yi.liu@eclipse-foundation.org>
|
I don't think we want to use a different visited link color for the sidebar. I see this as the same as the main menu. We don't have any styles for visited links in the main menu. |
|
!!!Note: Need to update assets CSS in order to remove the visited link color before working on this |
Signed-off-by: Eric Poirier <eric.poirier@eclipse-foundation.org>

Fix #350
Updated Jan 19, 2021:
Testing pages:
https://deploy-preview-539--eclipsefdn-iot.netlify.app/community/resources/
https://deploy-preview-539--eclipsefdn-iot.netlify.app/community/
https://deploy-preview-539--eclipsefdn-iot.netlify.app/adopters/how-to-be-listed-as-an-adopter/
https://deploy-preview-539--eclipsefdn-iot.netlify.app/projects/getting-started/
And I also did some adjustments in the
original sidebar.html, I removed the "row" margin in sub-sub-menu items which causes extra right spaces on mobile.And I modified a little logic since I don't know why in
config.tomlwe need to create duplicate sidebars.And I removed an
index.json membership page which does not exist and caused console log error.Old blabla:
What I have done so far:
TODO:
I probably go for collapsible, but it brings me to think of a question, For IOT site, it's kinda special since it has a sub parent menu(resources) who also have a link to go to. If using collapsible, we could not go to the link of resources in collapsible, but since it stays on the main menu, it's okay for this.
As long as we do not have cases that parent menu also has a link to go, I think collapsible works well.
The other way is to keep expanded of sub-children. Just hide or show them as a whole.
But if using dropdown, I do not need to use "", just a normal option, so that resources can be clicked and redirect to. It's just a matter of styling.
What do you think?
BTW, I also wanna add a para to control whether to show mobile-sidebar.
Signed-off-by: Yi Liu yi.liu@eclipse-foundation.org