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

Landing page designs #51

Merged
merged 33 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3ff6689
Outsource header search form
May 20, 2024
4c8e721
Add command to init submodules
May 20, 2024
6bc6ee7
Improve ahb page
May 20, 2024
59a4ec3
Improve ui for fulltext search
May 20, 2024
c0f3f35
Add ui for export button
May 20, 2024
3d6d6e6
Floating labels
May 20, 2024
cd565f3
Align align align
May 20, 2024
c5bd300
Add init highlight logic
May 20, 2024
f94511f
Merge branch 'main' into feature/highlight
May 22, 2024
ec7845c
Merge branch 'main' into feature/highlight
May 24, 2024
1f15413
Sticky header
May 24, 2024
a4e9318
Fix color
May 24, 2024
c6a6586
Sticky table header
May 24, 2024
4c7d62d
Make highlighting case insensitive
May 24, 2024
61ba8f7
Highlight selected elements
May 24, 2024
4ba4633
Scroll scroll scroll
May 24, 2024
23c3d62
Show results
May 24, 2024
84197e3
update tests
May 24, 2024
7c32e5e
AHB landing page design
May 25, 2024
0f002cd
Landindpage design
May 25, 2024
97ac75d
Texte
May 25, 2024
e3f4ef5
Fix test
May 25, 2024
c74c194
Outsource icons
May 25, 2024
9e8551c
Outsource layout components
May 25, 2024
23f08ea
...
May 25, 2024
1e18a6a
Fix test
May 25, 2024
4a69a3c
Update src/app/features/ahbs/views/ahb-landing-page/ahb-landing-page.…
TommyBom May 26, 2024
43fd457
Update src/app/features/landingpage/views/landing-page/landing-page.c…
TommyBom May 26, 2024
c1a51c6
Update src/app/features/landingpage/views/landing-page/landing-page.c…
TommyBom May 26, 2024
fcd81b9
Update src/app/features/landingpage/views/landing-page/landing-page.c…
TommyBom May 26, 2024
d4a758b
Update src/app/features/landingpage/views/landing-page/landing-page.c…
TommyBom May 26, 2024
5f8e9b0
Merge branch 'main' into feature/landing-page-design
TommyBom May 26, 2024
be3ab59
...
May 26, 2024
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: 0 additions & 2 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { ApiModule } from './core/api';
import { HttpClientModule } from '@angular/common/http';
import { environment } from './environments/environment';

console.log({ environment });

export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes, withComponentInputBinding()),
Expand Down
17 changes: 17 additions & 0 deletions src/app/core/helper/scroll-to-element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const scrollToElement = (
element: HTMLElement,
offsetY = 0,
container: HTMLElement | undefined,
) => {
if (!container) {
const elementPosition = element.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.scrollY - offsetY;
window.scrollTo({ top: offsetPosition });
return;
}
const containerRect = container.getBoundingClientRect();
const elementRect = element.getBoundingClientRect();
const offsetPosition =
elementRect.top - containerRect.top + container.scrollTop - offsetY;
container.scrollTo({ top: offsetPosition });
};
95 changes: 53 additions & 42 deletions src/app/features/ahbs/components/ahb-table/ahb-table.component.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,54 @@
<div class="relative overflow-x-auto">
<table
class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"
>
<thead class="text-xs text-gray-700 uppercase bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3">Segmentname</th>
<th scope="col" class="px-6 py-3">Segmentgruppe</th>
<th scope="col" class="px-6 py-3">Segment</th>
<th scope="col" class="px-6 py-3">Datenelement</th>
<th scope="col" class="px-6 py-3">Name</th>
<th scope="col" class="px-6 py-3">Bedingung</th>
<table class="table-auto w-full text-sm text-gray-500">
<thead class="text-xs text-gray-700 uppercase bg-gray-50" #header>
<tr>
<th scope="col" class="sticky top-0 bg-gray-50 px-6 py-3 text-left">
Segmentname
</th>
<th scope="col" class="sticky top-0 bg-gray-50 px-6 py-3 text-left">
Segmentgruppe
</th>
<th scope="col" class="sticky top-0 bg-gray-50 px-6 py-3 text-left">
Segment
</th>
<th scope="col" class="sticky top-0 bg-gray-50 px-6 py-3 text-left">
Datenelement
</th>
<th scope="col" class="sticky top-0 bg-gray-50 px-6 py-3 text-left">
Name
</th>
<th scope="col" class="sticky top-0 bg-gray-50 px-6 py-3 text-left">
Bedingung
</th>
</tr>
</thead>
<tbody>
@for (line of lines(); track line.index) {
<tr class="border-b">
<td
class="px-6 py-4"
[innerHTML]="line.section_name | highlight: highlight()"
></td>
<td
class="px-6 py-4"
[innerHTML]="line.segment_group_key | highlight: highlight()"
></td>
<td
class="px-6 py-4"
[innerHTML]="line.segment_code | highlight: highlight()"
></td>
<td
class="px-6 py-4"
[innerHTML]="line.data_element | highlight: highlight()"
></td>
<td
class="px-6 py-4"
[innerHTML]="line.name | highlight: highlight()"
></td>
<td
class="px-6 py-4"
[innerHTML]="line.ahb_expression | highlight: highlight()"
></td>
</tr>
</thead>
<tbody>
@for (line of lines; track line.index) {
<tr class="bg-white border-b">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap"
>
{{ line.section_name }}
</th>
<td class="px-6 py-4">
{{ line.segment_group_key }}
</td>
<td class="px-6 py-4">
{{ line.segment_code }}
</td>
<td class="px-6 py-4">
{{ line.data_element }}
</td>
<td class="px-6 py-4">
{{ line.name }}
</td>
<td class="px-6 py-4">
{{ line.ahb_expression }}
</td>
</tr>
}
</tbody>
</table>
</div>
}
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AhbTableComponent } from './ahb-table.component';
import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';

describe('AhbTableComponent', () => {
let component: AhbTableComponent;
let fixture: ComponentFixture<AhbTableComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AhbTableComponent],
}).compileComponents();

fixture = TestBed.createComponent(AhbTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(async () => MockBuilder(AhbTableComponent));

it('should create', () => {
expect(component).toBeTruthy();
it('should render', () => {
const fixture = MockRender(AhbTableComponent, {
lines: [],
});
ngMocks.formatHtml(fixture);
});
});
91 changes: 88 additions & 3 deletions src/app/features/ahbs/components/ahb-table/ahb-table.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,99 @@
import { Component, Input } from '@angular/core';
import {
Component,
ElementRef,
computed,
effect,
input,
output,
signal,
viewChild,
} from '@angular/core';
import { Ahb } from '../../../../core/api';
import { JsonPipe } from '@angular/common';
import { HighlightPipe } from '../../../../shared/pipes/highlight.pipe';

@Component({
selector: 'app-ahb-table',
standalone: true,
imports: [JsonPipe],
imports: [JsonPipe, HighlightPipe],
templateUrl: './ahb-table.component.html',
styleUrl: './ahb-table.component.scss',
})
export class AhbTableComponent {
@Input({ required: true }) lines!: Ahb['lines'];
header = viewChild<ElementRef>('header');

lines = input.required<Ahb['lines']>();
highlight = input<string | undefined>();

selectElement = output<{ element: HTMLElement; offsetY: number }>();

markIndex = signal(0);

markElements = computed<HTMLElement[]>(() => {
const highlight = this.highlight();
const nativeElement = this.elementRef.nativeElement;
if (!highlight || !nativeElement) {
return [];
}
return nativeElement.querySelectorAll('mark');
});

selectedMarkElement = computed(() => {
const markIndex = this.markIndex();
const markElements = this.markElements();
if (markElements.length === 0 || markElements.length < markIndex + 1) {
return null;
}
return markElements[this.markIndex()];
});

constructor(private readonly elementRef: ElementRef) {
// reset index on highlight change
effect(
() => {
this.highlight();
this.markIndex.set(0);
},
{
allowSignalWrites: true,
},
);
effect(() => {
const selectedMarkElement = this.selectedMarkElement();
if (selectedMarkElement === null) {
return;
}
// make selected element orange
const markElements = this.markElements();
markElements.forEach((el) => el.classList.remove('bg-orange-500'));
selectedMarkElement.classList.add('bg-orange-500');
// notify outer scroll container
const header = this.header();
const headerHeight =
header?.nativeElement.getBoundingClientRect().height ?? 0;
this.selectElement.emit({
element: selectedMarkElement,
offsetY: headerHeight,
});
});
}

nextResult() {
const markIndex = this.markIndex() + 1;
const markElements = this.markElements();
if (markIndex < markElements.length) {
this.markIndex.set(markIndex);
return;
}
this.markIndex.set(0);
}

previousResult() {
const markIndex = this.markIndex() - 1;
if (markIndex >= 0) {
this.markIndex.set(markIndex);
return;
}
this.markIndex.set(this.markElements().length - 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
<div class="flex flex-col items-start mt-2 h-auto w-full">
<select
id="format-version-select"
class="inline-block border-2 border-white rounded bg-[#F6ECED] py-3 ps-3 pe-24 focus:outline-0 w-full"
class="inline-block border-2 border-white rounded bg-tint py-3 ps-3 pe-24 focus:outline-0 w-full"
[formControl]="control"
(change)="onChange ? onChange(control.value) : null"
>
<option value="">Bitte auswählen</option>
@for (formatVersion of formatVersions; track formatVersion) {
<option [value]="formatVersion">{{ formatVersion }}</option>
}
</select>
<label
for="format-version-select"
class="ml-3 -mt-14 text-xs text-blue-600 inline-block text-[#737373] text-[12px] bg-white px-1"
class="ml-3 -mt-14 text-xs inline-block text-slate-500 text-[12px] bg-white px-1"
>
Formatversion
</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="flex flex-col items-start mt-2 w-full">
<input
class="rounded border-2 border-white bg-[#F6ECED] py-2.5 px-2 focus:outline-0 w-full"
class="rounded border-2 border-white bg-tint py-2.5 px-2 focus:outline-0 w-full"
type="text"
list="pruefi-list"
[formControl]="control"
Expand All @@ -9,7 +9,7 @@
/>
<label
for="format-version-select"
class="ml-3 -mt-14 text-xs text-blue-600 inline-block text-[#737373] text-[12px] bg-white px-1"
class="ml-3 -mt-14 text-xs inline-block text-slate-500 text-[12px] bg-white px-1"
>
Prüfidentifikator
</label>
Expand Down
Loading