Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(addon-doc): add ability to disable default search-bar #9099

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions projects/addon-doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ npm i @taiga-ui/addon-doc

`TUI_DOC_SEE_ALSO` — a two dimensional array of related pages by their titles

`TUI_DOC_SEARCH_ENABLED` — enable doc search. Default value is true

4. Configure routing:

```typescript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {Router, RouterLink, RouterLinkActive, Scroll} from '@angular/router';
import {
TUI_DOC_ICONS,
TUI_DOC_PAGE_LOADED,
TUI_DOC_SEARCH_ENABLED,
TUI_DOC_SEARCH_TEXT,
} from '@taiga-ui/addon-doc/tokens';
import type {TuiDocRoutePage, TuiDocRoutePages} from '@taiga-ui/addon-doc/types';
Expand Down Expand Up @@ -91,6 +92,7 @@ export class TuiDocNavigation {
protected readonly labels = inject(NAVIGATION_LABELS);
protected readonly items = inject(NAVIGATION_ITEMS);
protected readonly searchText = inject(TUI_DOC_SEARCH_TEXT);
protected readonly searchEnabled = inject(TUI_DOC_SEARCH_ENABLED);
protected readonly docIcons = inject(TUI_DOC_ICONS);
protected readonly icons = inject(TUI_COMMON_ICONS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
}
}

.t-accordion-standalone {
margin-top: 1rem;
}

.t-scrollbar {
scroll-behavior: var(--tui-scroll-behavior);
inline-size: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<tui-textfield
*ngIf="searchEnabled"
tuiTextfieldSize="m"
class="t-input"
[iconStart]="docIcons.search"
Expand Down Expand Up @@ -66,6 +67,7 @@
<nav class="t-navigation">
<tui-scrollbar class="t-scrollbar">
<tui-accordion
[class.t-accordion-standalone]="!searchEnabled"
[closeOthers]="false"
[rounded]="false"
>
Expand Down
1 change: 1 addition & 0 deletions projects/addon-doc/tokens/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ export const TUI_DOC_MENU_TEXT = tuiCreateToken('Menu');
export const TUI_DOC_SEARCH_TEXT = tuiCreateToken('Search');
export const TUI_DOC_SEE_ALSO_TEXT = tuiCreateToken('See also');
export const TUI_DOC_SOURCE_CODE_TEXT = tuiCreateToken('Source code');
export const TUI_DOC_SEARCH_ENABLED = tuiCreateToken(true);
5 changes: 5 additions & 0 deletions projects/demo/src/modules/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,
TUI_DOC_LOGO,
TUI_DOC_PAGES,
TUI_DOC_SEARCH_ENABLED,
TUI_DOC_SEE_ALSO,
TUI_DOC_SOURCE_CODE,
TUI_DOC_TITLE,
Expand Down Expand Up @@ -135,6 +136,10 @@ export const config: ApplicationConfig = {
provide: TUI_DOC_LOGO,
useValue: LOGO_CONTENT,
},
{
provide: TUI_DOC_SEARCH_ENABLED,
useValue: false,
},
{
provide: TUI_DOC_CODE_EDITOR,
useClass: TuiStackblitzService,
Expand Down
Loading