From 36a465f1e773bea2c327b4a2319c8daf641ce8b6 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 20 Jul 2023 14:48:03 +0200 Subject: [PATCH] doc: add tile with 2 images (#468) --- .../src/app/app-routing.module.ts | 5 + .../src/app/main-nav/main-nav.component.html | 36 +--- .../tile-2-images/tile-2-images.component.css | 187 ++++++++++++++++++ .../tile-2-images.component.html | 23 +++ .../tile-2-images.component.spec.ts | 21 ++ .../tile-2-images/tile-2-images.component.ts | 45 +++++ .../app/tile-2-images/tile-2-images.module.ts | 12 ++ .../app/tile-2-images/tile-routing.module.ts | 12 ++ 8 files changed, 314 insertions(+), 27 deletions(-) create mode 100644 apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.css create mode 100644 apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.html create mode 100644 apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.spec.ts create mode 100644 apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.ts create mode 100644 apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.module.ts create mode 100644 apps/ngu-carousel-example/src/app/tile-2-images/tile-routing.module.ts diff --git a/apps/ngu-carousel-example/src/app/app-routing.module.ts b/apps/ngu-carousel-example/src/app/app-routing.module.ts index c237a510..89ac5bf1 100644 --- a/apps/ngu-carousel-example/src/app/app-routing.module.ts +++ b/apps/ngu-carousel-example/src/app/app-routing.module.ts @@ -11,6 +11,11 @@ const routes: Routes = [ path: 'tile', loadChildren: () => import('./tile/tile.module').then(m => m.TileModule) }, + { + path: 'tile-2-images', + loadChildren: () => + import('./tile-2-images/tile-2-images.module').then(m => m.Tile2ImagesModule) + }, { path: 'banner-vertical', loadChildren: () => diff --git a/apps/ngu-carousel-example/src/app/main-nav/main-nav.component.html b/apps/ngu-carousel-example/src/app/main-nav/main-nav.component.html index df805aee..a9cec713 100644 --- a/apps/ngu-carousel-example/src/app/main-nav/main-nav.component.html +++ b/apps/ngu-carousel-example/src/app/main-nav/main-nav.component.html @@ -1,48 +1,30 @@ - + Banner Types Tile Banner Banner Vertical + Tile with 2 Images Wrapped Carousel - ngu-carousel Documentation - - Github + + Github GitHub - + \ No newline at end of file diff --git a/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.css b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.css new file mode 100644 index 00000000..b83d2b60 --- /dev/null +++ b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.css @@ -0,0 +1,187 @@ +.bannerStyle div { + background-color: #ccc; + background-size: cover !important; + height: 100%; +} + +.bannerStyle img { + width: 100%; + height: 100%; +} + +.bannerStyle h1 { + text-align: center; + background: rgba(0, 0, 0, 0.32); + color: white; + margin: 0; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.tile { + min-height: 200px; + background-color: #ccc; + background-size: cover !important; +} + +.tile h1 { + text-align: center; + line-height: 200px; + background: rgba(0, 0, 0, 0.32); + color: white; + margin: 0; +} + +h4 { + margin: 0; + padding: 10px 15px; + text-align: center; +} + +p { + margin: 0; + padding: 0 15px 10px; + text-align: center; +} + +.wBg { + background: white; +} + +.container { + max-width: 1200px; + margin: 0 auto; +} + +nav { + border-bottom: 1px solid #ccc; + position: fixed; + width: 100%; + top: 0; + background: white; + z-index: 12; +} + +nav h1 { + margin: 0; + padding: 10px; + text-align: center; +} + +.carBtn { + position: absolute; + margin: auto; + top: 0; + bottom: 0; + width: 50px; + height: 50px; + box-shadow: 1px 2px 10px -1px rgba(0, 0, 0, 0.3); + border-radius: 999px; +} + +.leftRs { + position: absolute; + margin: auto; + top: 0; + bottom: 0; + width: 50px; + height: 50px; + box-shadow: 1px 2px 10px -1px rgba(0, 0, 0, 0.3); + border-radius: 999px; + left: 0; + z-index: 1; +} + +.rightRs { + position: absolute; + margin: auto; + top: 0; + bottom: 0; + width: 50px; + height: 50px; + box-shadow: 1px 2px 10px -1px rgba(0, 0, 0, 0.3); + border-radius: 999px; + right: 0; + z-index: 1; +} + +.leftRs1 { + position: absolute; + margin: auto; + top: 0; + bottom: 0; + width: 50px; + height: 50px; + box-shadow: 1px 2px 10px -1px rgba(0, 0, 0, 0.3); + border-radius: 999px; + right: 0; +} + +.rightRs1 { + position: absolute; + margin: auto; + top: 0; + bottom: 0; + width: 50px; + height: 50px; + box-shadow: 1px 2px 10px -1px rgba(0, 0, 0, 0.3); + border-radius: 999px; + left: 0; +} + +.myPoint { + list-style-type: none; + text-align: center; + padding: 12px; + margin: 0; + white-space: nowrap; + overflow: auto; + box-sizing: border-box; + li { + display: inline-block; + border-radius: 50%; + border: 2px solid rgba(0, 0, 0, 0.55); + padding: 4px; + margin: 0 3px; + transition-timing-function: cubic-bezier(0.17, 0.67, 0.83, 0.67); + transition: 0.4s; + &.active { + background: #6b6b6b; + transform: scale(1.2); + } + } +} + +.carouselHoved { + opacity: 0.4; +} + +.myBannerPoint { + position: absolute; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + width: 100%; + left: 0; + bottom: 0; + padding: 0; + color: beige; + justify-content: center; + list-style-type: none; + background: rgba(0, 0, 0, 0.34); + margin: 0; + padding: 10px; + box-sizing: border-box; + li { + background: #6b6b6b; + width: 50px; + height: 50px; + margin-right: 10px; + &.active { + transform: translateY(-10px); + transition: 0.3s ease all; + } + } +} diff --git a/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.html b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.html new file mode 100644 index 00000000..9900ecf1 --- /dev/null +++ b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.html @@ -0,0 +1,23 @@ + + + + +
+

{{ i + 1 }}

+
+
+ + + + +
diff --git a/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.spec.ts b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.spec.ts new file mode 100644 index 00000000..1605a34a --- /dev/null +++ b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { Tile2ImagesComponent } from './tile-2-images.component'; + +describe('Tile2ImagesComponent', () => { + let component: Tile2ImagesComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [Tile2ImagesComponent] + }).compileComponents(); + + fixture = TestBed.createComponent(Tile2ImagesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.ts b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.ts new file mode 100644 index 00000000..183c7cac --- /dev/null +++ b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.component.ts @@ -0,0 +1,45 @@ +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { NguCarouselConfig } from '@ngu/carousel'; +import { interval, Observable } from 'rxjs'; +import { map, startWith, take } from 'rxjs/operators'; +import { slider } from '../slide-animation'; + +@Component({ + selector: 'app-tile-2-images', + templateUrl: './tile-2-images.component.html', + styleUrls: ['./tile-2-images.component.css'], + animations: [slider] +}) +export class Tile2ImagesComponent { + images = ['assets/bg.jpg', 'assets/car.png']; + + public carouselTileItems$: Observable; + public carouselTileConfig: NguCarouselConfig = { + grid: { xs: 1, sm: 1, md: 1, lg: 5, all: 0 }, + speed: 250, + point: { + visible: true + }, + touch: true, + loop: true, + interval: { timing: 1500 }, + animation: 'lazy' + }; + tempData: any[]; + + constructor() { + this.tempData = []; + this.carouselTileItems$ = interval(500).pipe( + startWith(-1), + take(2), + map(() => { + const data = (this.tempData = [ + ...this.tempData, + this.images[Math.floor(Math.random() * this.images.length)] + ]); + + return data; + }) + ); + } +} diff --git a/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.module.ts b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.module.ts new file mode 100644 index 00000000..728d3ea9 --- /dev/null +++ b/apps/ngu-carousel-example/src/app/tile-2-images/tile-2-images.module.ts @@ -0,0 +1,12 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { NguCarouselModule } from '@ngu/carousel'; + +import { Tile2RoutingModule } from './tile-routing.module'; +import { Tile2ImagesComponent } from './tile-2-images.component'; + +@NgModule({ + declarations: [Tile2ImagesComponent], + imports: [CommonModule, Tile2RoutingModule, NguCarouselModule] +}) +export class Tile2ImagesModule {} diff --git a/apps/ngu-carousel-example/src/app/tile-2-images/tile-routing.module.ts b/apps/ngu-carousel-example/src/app/tile-2-images/tile-routing.module.ts new file mode 100644 index 00000000..bb5d7128 --- /dev/null +++ b/apps/ngu-carousel-example/src/app/tile-2-images/tile-routing.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +import { Tile2ImagesComponent } from './tile-2-images.component'; + +const routes: Routes = [{ path: '', component: Tile2ImagesComponent }]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class Tile2RoutingModule {}