UX: in sidebar dropdown mode expose 'more' items (#21372)

This commit is contained in:
Kris 2023-05-03 19:26:00 -04:00 committed by GitHub
parent c636fcf4fc
commit 36c3a2422b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 4 deletions

View File

@ -33,8 +33,17 @@
/>
{{/each}}
<Sidebar::MoreSectionLinks
@sectionLinks={{this.moreSectionLinks}}
@secondarySectionLinks={{this.moreSecondarySectionLinks}}
/>
{{#if this.isDesktopDropdownMode}}
{{#each this.moreSectionLinks as |sectionLink|}}
<Sidebar::MoreSectionLink @sectionLink={{sectionLink}} />
{{/each}}
{{#each this.moreSecondarySectionLinks as |sectionLink|}}
<Sidebar::MoreSectionLink @sectionLink={{sectionLink}} />
{{/each}}
{{else}}
<Sidebar::MoreSectionLinks
@sectionLinks={{this.moreSectionLinks}}
@secondarySectionLinks={{this.moreSecondarySectionLinks}}
/>
{{/if}}
</Sidebar::Section>

View File

@ -12,6 +12,7 @@ export default class SidebarCommunitySection extends Component {
@service topicTrackingState;
@service currentUser;
@service appEvents;
@service site;
@service siteSettings;
@tracked sectionLinks;
@ -77,6 +78,13 @@ export default class SidebarCommunitySection extends Component {
return [];
}
get isDesktopDropdownMode() {
const headerDropdownMode =
this.siteSettings.navigation_menu === "header dropdown";
return !this.site.mobileView && headerDropdownMode;
}
#initializeSectionLinks(sectionLinkClasses, { inMoreDrawer } = {}) {
return sectionLinkClasses.map((sectionLinkClass) => {
return this.#initializeSectionLink(sectionLinkClass, inMoreDrawer);

View File

@ -51,6 +51,21 @@ acceptance(
"hides the sidebar dropdown"
);
});
test("'more' dropdown should display as regular list items in header dropdown mode", async function (assert) {
await visit("/");
await click(".hamburger-dropdown");
assert.ok(
exists("[data-link-name='admin']"),
"the admin link is not within the 'more' dropdown"
);
assert.notOk(
exists(".sidebar-more-section-links-details-summary"),
"the 'more' dropdown should not be present in header dropdown mode"
);
});
}
);