Updated news functionality

This commit is contained in:
Erik Tiekstra
2021-11-11 15:56:49 +01:00
parent 397b6769a2
commit 9806776b2f
15 changed files with 87 additions and 56 deletions

View File

@@ -1,6 +0,0 @@
<ng-container *ngIf="newsData$ | async as news">
<h1>{{news.title}}</h1>
<hr />
<div [innerHtml]="news.body"></div>
</ng-container>
<ui-loader *ngIf="newsLoading$ | async" uiType="padded"></ui-loader>

View File

@@ -1,5 +0,0 @@
@import 'variables/gutters';
h1 {
margin-top: $digi--layout--gutter--xl;
}

View File

@@ -1,22 +0,0 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NewsComponent } from './news.component';
describe('NewsComponent', () => {
let component: NewsComponent;
let fixture: ComponentFixture<NewsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [NewsComponent]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(NewsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,17 +0,0 @@
import { Component } from '@angular/core';
import { News } from '@msfa-models/news.model';
import { NewsApiService } from '@msfa-services/api/news.api.service';
import { Observable } from 'rxjs';
@Component({
selector: 'msfa-news',
templateUrl: 'news.component.html',
styleUrls: ['news.component.scss']
})
export class NewsComponent {
newsData$: Observable<News> = this.newsApiService.fetchNews$();
newsLoading$: Observable<boolean> = this.newsApiService.newsLoading$;
constructor(private newsApiService: NewsApiService) { }
}

View File

@@ -1,14 +0,0 @@
import { CommonModule } from '@angular/common';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { UiLoaderModule } from '@ui/loader/loader.module';
import { NewsComponent } from './news.component';
@NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [NewsComponent],
imports: [CommonModule, UiLoaderModule],
exports: [NewsComponent]
})
export class NewsModule {
}