1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-08 15:05:26 +02:00

Added ability to change nesting in flat array, fixed BEM

This commit is contained in:
slaveeks 2022-07-29 13:39:44 +03:00
parent 1a0f3e2fdf
commit f6280f32e6
3 changed files with 11 additions and 6 deletions

View file

@ -24,12 +24,12 @@ export interface PagesFlatArrayData {
/**
* id of parent with parent id '0'
*/
rootId?: string;
rootId: string;
/**
* Page level in sidebar view
*/
level?: number;
level: number;
/**
* Page title
@ -50,9 +50,10 @@ class PagesFlatArray {
/**
* Returns pages flat array
*
* @param fullNesting - does flat array consist full nesting
* @returns {Promise<Array<PagesFlatArrayData>>}
*/
public static async get(): Promise<Array<PagesFlatArrayData>> {
public static async get(fullNesting: boolean = false): Promise<Array<PagesFlatArrayData>> {
// Get flat array from cache
let arr = cache.get(cacheKey) as Array<PagesFlatArrayData>;
@ -61,7 +62,11 @@ class PagesFlatArray {
arr = await this.regenerate();
}
return arr;
if (fullNesting) {
return arr
}
return arr.filter( (item) => item.level < 2 );
}
/**

View file

@ -19,7 +19,7 @@ Usage example:
{% set tag = 'a' %}
{% endif %}
<div class="navigator__wrapper">
<div class="navigator--wrapper">
{% if label and url %}
<{{ tag }}
{{ name is not empty ? 'name="' ~ name ~ '"': '' }}

View file

@ -33,7 +33,7 @@
}
}
.navigator__wrapper {
.navigator--wrapper {
max-width: 100%;
margin: 0;
padding: 0;