mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 00:45:33 +08:00
UX: in sidebar dropdown mode expose 'more' items (#21372)
This commit is contained in:
parent
c636fcf4fc
commit
36c3a2422b
@ -33,8 +33,17 @@
|
|||||||
/>
|
/>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
|
{{#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
|
<Sidebar::MoreSectionLinks
|
||||||
@sectionLinks={{this.moreSectionLinks}}
|
@sectionLinks={{this.moreSectionLinks}}
|
||||||
@secondarySectionLinks={{this.moreSecondarySectionLinks}}
|
@secondarySectionLinks={{this.moreSecondarySectionLinks}}
|
||||||
/>
|
/>
|
||||||
|
{{/if}}
|
||||||
</Sidebar::Section>
|
</Sidebar::Section>
|
@ -12,6 +12,7 @@ export default class SidebarCommunitySection extends Component {
|
|||||||
@service topicTrackingState;
|
@service topicTrackingState;
|
||||||
@service currentUser;
|
@service currentUser;
|
||||||
@service appEvents;
|
@service appEvents;
|
||||||
|
@service site;
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
|
|
||||||
@tracked sectionLinks;
|
@tracked sectionLinks;
|
||||||
@ -77,6 +78,13 @@ export default class SidebarCommunitySection extends Component {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isDesktopDropdownMode() {
|
||||||
|
const headerDropdownMode =
|
||||||
|
this.siteSettings.navigation_menu === "header dropdown";
|
||||||
|
|
||||||
|
return !this.site.mobileView && headerDropdownMode;
|
||||||
|
}
|
||||||
|
|
||||||
#initializeSectionLinks(sectionLinkClasses, { inMoreDrawer } = {}) {
|
#initializeSectionLinks(sectionLinkClasses, { inMoreDrawer } = {}) {
|
||||||
return sectionLinkClasses.map((sectionLinkClass) => {
|
return sectionLinkClasses.map((sectionLinkClass) => {
|
||||||
return this.#initializeSectionLink(sectionLinkClass, inMoreDrawer);
|
return this.#initializeSectionLink(sectionLinkClass, inMoreDrawer);
|
||||||
|
@ -51,6 +51,21 @@ acceptance(
|
|||||||
"hides the sidebar dropdown"
|
"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"
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user