Skip to content

Commit 42b72c3

Browse files
committed
✨ scroll infinite added to home
1 parent e8930ab commit 42b72c3

16 files changed

+418
-9
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@angular/platform-browser": "~13.2.0",
1919
"@angular/platform-browser-dynamic": "~13.2.0",
2020
"@angular/router": "~13.2.0",
21+
"ngx-infinite-scroll": "^13.0.2",
2122
"rxjs": "~7.5.0",
2223
"tslib": "^2.3.0",
2324
"zone.js": "~0.11.4"

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
3+
import { HttpClientModule } from '@angular/common/http';
34

45
import { AppComponent } from './app.component';
56
import { AppRoutingModule } from './app.routing';
@@ -11,8 +12,9 @@ import { FeaturesModule } from './features/features.module';
1112
],
1213
imports: [
1314
BrowserModule,
15+
HttpClientModule,
1416
AppRoutingModule,
15-
FeaturesModule
17+
FeaturesModule,
1618
],
1719
providers: [],
1820
bootstrap: [AppComponent]

src/app/core/components/sidebar/sidebar.component.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ nav.open li a .links_name {
145145

146146
nav li a:hover .links_name,
147147
nav li a:hover i {
148-
transition: all 0.5s ease;
149-
/* color: var(--primary-color); */
148+
transition: 0.5s ease;
150149
}
151150

152151
nav li i {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Feed } from "../models/feed.model";
2+
3+
export interface IResponseFeed {
4+
ok: boolean;
5+
feeds: Feed[];
6+
feed: Feed;
7+
msg?: string;
8+
};

src/app/core/models/feed.model.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Website } from "./website.model";
2+
3+
export class Feed {
4+
constructor(
5+
public writer: string,
6+
public title: string,
7+
public pubDate: Date,
8+
public content: string,
9+
public link: string,
10+
public image: string,
11+
public website: Website,
12+
) {};
13+
};

src/app/core/models/website.model.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export class Website {
2+
constructor(
3+
public name: string,
4+
public image: string,
5+
public description: string,
6+
public link: string,
7+
public linkFeed: string,
8+
) {};
9+
};

src/app/core/services/feed.service.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Injectable } from '@angular/core';
2+
import { HttpClient } from '@angular/common/http';
3+
import { environment } from 'environments/environment';
4+
import { Observable } from 'rxjs';
5+
6+
import { IResponseFeed } from '@interfaces/response.interface';
7+
8+
const base_url = environment.base_url;
9+
10+
@Injectable({
11+
providedIn: 'root'
12+
})
13+
export class FeedService {
14+
15+
constructor(private http: HttpClient) { }
16+
17+
getFeeds(skip = 0, limit = 20): Observable<IResponseFeed> {
18+
const url = `${base_url}/feed?skip=${skip}&limit=${limit}`;
19+
return this.http.get<IResponseFeed>(url);
20+
}
21+
22+
}

src/app/features/features.component.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
width: 100%;
99
margin-left: 250px;
1010
width: auto;
11-
transition: 0.5s;
1211
background: #f4faff;
1312
}
1413

src/app/features/features.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { FeaturesComponent } from './features.component';
55
import { RouterModule } from '@angular/router';
66

77
import { ComponentsModule } from '@components/components.module';
8+
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
89

910
@NgModule({
1011
declarations: [
@@ -14,7 +15,8 @@ import { ComponentsModule } from '@components/components.module';
1415
imports: [
1516
CommonModule,
1617
RouterModule,
17-
ComponentsModule
18+
ComponentsModule,
19+
InfiniteScrollModule
1820
]
1921
})
2022
export class FeaturesModule { }

0 commit comments

Comments
 (0)