Skip to content

Commit 2549eec

Browse files
author
Dobromir Hristov
committed
refactor: reduce items to show, if has badge
1 parent a09bf18 commit 2549eec

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/components/DocumentationTopic/DocumentationNav/Hierarchy.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,12 @@ export default {
124124
* Figure out how many items we can show, after the collapsed items,
125125
* based on the window.innerWidth
126126
*/
127-
linksAfterCollapse: ({ windowWidth }) => {
127+
linksAfterCollapse: ({ windowWidth, hasBadge }) => {
128+
const extraItemsToRemove = hasBadge ? 1 : 0;
128129
// never show more than the `MaxVisibleItems`
129-
if (windowWidth > 1200) return MaxVisibleItems;
130-
if (windowWidth > 1000) return MaxVisibleItems - 1;
131-
if (windowWidth >= 800) return MaxVisibleItems - 2;
130+
if (windowWidth > 1200) return MaxVisibleItems - extraItemsToRemove;
131+
if (windowWidth > 1000) return MaxVisibleItems - 1 - extraItemsToRemove;
132+
if (windowWidth >= 800) return MaxVisibleItems - 2 - extraItemsToRemove;
132133
return 0;
133134
},
134135
collapsibleItems: ({ parentTopics, linksAfterCollapse }) => (

0 commit comments

Comments
 (0)