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

Navigate to element on title or description click #300

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
<div class="components">
@for (component of components; track component.item.name) {
<div class="card">
<p class="label">{{ component.item.labels ? getFirstLabel(component.item.labels) : '' }}</p>
<p class="name" [title]="component.item.name">{{ component.item.name }}</p>
<p class="label">
{{ component.item.labels ? getFirstLabel(component.item.labels) : '' }}
</p>
<p class="name" [title]="component.item.name" (click)="navigateToElement(component.item)">
{{ component.item.name }}
</p>
<p class="element-names" [title]="component.item.elementNames.join('\n')">
@for (elementName of component.item.elementNames; track elementName; let first = $first) {
@if (!first) {
Expand All @@ -24,15 +28,10 @@
<span>{{ elementName }}</span>
}
</p>
<p class="description">{{ component.item.description | truncate: 150 }}</p>
<ff-button
[routerLink]="
component.item.labels
? ['/', getFirstFilter(component.item.labels), getFirstLabel(component.item.labels), component.item.name]
: ['/', component.item.fullName]
"
>&rarr;</ff-button
>
<p class="description" (click)="navigateToElement(component.item)">
{{ component.item.description | truncate: 150 }}
</p>
<ff-button (click)="navigateToElement(component.item)">&rarr;</ff-button>
</div>
} @empty {
<p>No Elements found.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
text-overflow: ellipsis;
}

.name, .description {
user-select: none;
cursor: pointer;
}

.label {
letter-spacing: 2.1px;
text-transform: uppercase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Component, inject, Input } from '@angular/core';
import { ButtonComponent } from '@frankframework/angular-components';
import { FuseResult } from 'fuse.js';
import { Element } from '../../../frankdoc.types';
import { RouterLink } from '@angular/router';
import { Router } from '@angular/router';
import { AppService } from '../../../app.service';
import { TruncatePipe } from '../../../components/truncate.pipe';
import { environment } from '../../../../environments/environment';

@Component({
selector: 'app-home-component-list',
standalone: true,
imports: [ButtonComponent, RouterLink, TruncatePipe],
imports: [ButtonComponent, TruncatePipe],
templateUrl: './home-component-list.component.html',
styleUrl: './home-component-list.component.scss',
})
Expand All @@ -20,7 +20,15 @@ export class HomeComponentListComponent {
protected relatedComponents: FuseResult<Element>[] = [];
protected showRelated: boolean = environment.relatedSearchResults;

private router: Router = inject(Router);
private appService: AppService = inject(AppService);
protected getFirstFilter = this.appService.getFirstFilter;
protected getFirstLabel = this.appService.getFirstLabel;

protected navigateToElement(element: Element): void {
const route = element.labels
? ['/', this.getFirstFilter(element.labels), this.getFirstLabel(element.labels), element.name]
: ['/', element.fullName];
this.router.navigate(route);
}
}