Skip to content

Commit

Permalink
feat(): update all examples with the new gui based on official doc we…
Browse files Browse the repository at this point in the history
…bsite #144
  • Loading branch information
Ks89 committed Oct 29, 2018
1 parent 6043ce6 commit 6fe15d2
Show file tree
Hide file tree
Showing 164 changed files with 4,742 additions and 429 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- write full internal documentation (npm run docs)

### Demos
- create a new GUI for all examples based on the official documentation website v7
- update all examples, adding @angular/cdk (also to SystemJS example), because it was missing


Expand Down
4 changes: 2 additions & 2 deletions examples/angular-cli-6/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"assets": ["src/favicon.png", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
},
Expand Down Expand Up @@ -72,7 +72,7 @@
"karmaConfig": "src/karma.conf.js",
"styles": ["styles.scss"],
"scripts": [],
"assets": ["src/favicon.ico", "src/assets"]
"assets": ["src/favicon.png", "src/assets"]
}
},
"lint": {
Expand Down
3 changes: 2 additions & 1 deletion examples/angular-cli-6/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { ModalGalleryComponent } from './modal-gallery/modal-gallery.component';
import { PlainGalleryComponent } from './plain-gallery/plain-gallery.component';
import { CarouselComponent } from './carousel/carousel.component';
import { CarouselIe11Component } from './carousel-ie11/carousel-ie11.component';
import { HomeComponent } from './home/home.component';

const routes: Routes = [
{ path: '', component: CarouselComponent },
{ path: '', component: HomeComponent },
{ path: 'carousel', component: CarouselComponent },
{ path: 'carousel-ie11', component: CarouselIe11Component },
{ path: 'modal', component: ModalGalleryComponent },
Expand Down
19 changes: 7 additions & 12 deletions examples/angular-cli-6/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<h1 id="main-title">@ks89/angular-modal-gallery</h1>
<br>
<nav id="menu">
<a class="menu-item" routerLink="/carousel"><h2><u>carousel</u></h2></a>&nbsp;&nbsp;
<a class="menu-item" routerLink="/carousel-ie11"><h2><u>carousel legacy (IE11 support)</u></h2></a>&nbsp;&nbsp;
<a class="menu-item" routerLink="/modal"><h2><u>modal-gallery</u></h2></a>&nbsp;&nbsp;
<a class="menu-item" routerLink="/plain"><h2><u>plain-gallery</u></h2></a>
</nav>
<hr>
<ks-navbar></ks-navbar>

<br><br>

<router-outlet></router-outlet>

<br><br>
<h4 class="copyright">This library and these examples are created by <a href="https://github.com/Ks89">Stefano Cappa (@Ks89)</a></h4>
<hr>
<h4 class="copyright margin">This library and these examples are created by <a href="https://github.com/Ks89">Stefano Cappa (@Ks89)</a></h4>

<section>
<section class="margin">
<h4>A special thank to all authors of icons used in this library:</h4>
<ul>
<li>Icons made by <a href="https://www.flaticon.com/authors/smartline" title="Smartline">Smartline</a> from <a
Expand Down Expand Up @@ -47,7 +42,7 @@ <h4>A special thank to all authors of icons used in this library:</h4>
</ul>
</section>

<section>
<section class="margin">
<h4>A special thanks to all authors of spinners used in this library:</h4>
<ul>
<li><a href="https://github.com/lukehaas">Luke Haas (@lukehaas)</a> - <a
Expand Down
5 changes: 5 additions & 0 deletions examples/angular-cli-6/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@
.copyright {
text-align: center;
}

.margin {
margin-left: 15px;
margin-right: 15px;
}
2 changes: 1 addition & 1 deletion examples/angular-cli-6/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
selector: 'ks-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
Expand Down
12 changes: 10 additions & 2 deletions examples/angular-cli-6/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import { CarouselComponent } from './carousel/carousel.component';
import { CarouselIe11Component } from './carousel-ie11/carousel-ie11.component';
import { PlainGalleryComponent } from './plain-gallery/plain-gallery.component';
import { ModalGalleryComponent } from './modal-gallery/modal-gallery.component';
import { NavbarComponent } from './navbar/navbar.component';
import { HomeComponent } from './home/home.component';
import { IntroHeaderComponent } from './intro-header/intro-header.component';

// ********************** angular-modal-gallery *****************************
import 'hammerjs'; // Mandatory for angular-modal-gallery 3.x.x or greater (`npm i --save hammerjs`)
Expand All @@ -50,11 +53,16 @@ dom.watch(); // Kicks off the process of finding <i> tags and replacing with <sv
// *************************************************************************

@NgModule({
declarations: [AppComponent,
declarations: [
AppComponent,
CarouselComponent,
CarouselIe11Component,
PlainGalleryComponent,
ModalGalleryComponent],
ModalGalleryComponent,
NavbarComponent,
HomeComponent,
IntroHeaderComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Component } from '@angular/core';
import { Image } from '@ks89/angular-modal-gallery';

@Component({
selector: 'ks-carousel-page',
selector: 'ks-carousel-ie11-page',
templateUrl: './carousel-ie11.html',
styleUrls: ['./carousel-ie11.scss']
})
Expand Down
12 changes: 6 additions & 6 deletions examples/angular-cli-6/src/app/carousel-ie11/carousel-ie11.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2 class="title">Carousel legacy (IE11) support</h2>
<hr>
<br>

<p class="red-text">ATTENTION! Carousel supports Internet Explorer 11 only if you enable legacy mode.
For more info, please check the <a href="https://ks89.github.io/angular-modal-gallery-2018-v7.github.io/features/modal-gallery">official documentation</a>
Expand All @@ -10,7 +10,7 @@ <h3>D1 - (id=300) - carousel example for IE11 (minimal with all defaults, but le
<p>Obviously, objectFit is ignored when legacyIE11Mode is enabled</p>
<br>
<ks-carousel [id]="300" [images]="imagesRect"
[carouselConfig]="{maxWidth: '100%', maxHeight: '400px', showArrows: true, objectFit: 'cover', keyboardEnable: true, modalGalleryEnable: false, legacyIE11Mode: true}">
[carouselConfig]="{maxWidth: '100%', maxHeight: '400px', showArrows: true, objectFit: 'cover', keyboardEnable: true, modalGalleryEnable: false, legacyIE11Mode: true}">
<div class="projected">This is my projected content!</div>
</ks-carousel>
</section>
Expand All @@ -19,8 +19,8 @@ <h3>D1 - (id=300) - carousel example for IE11 (minimal with all defaults, but le
<h3>D2 - (id=301) - carousel example for IE11 with fixed maxWidth (766px), legacyMode enabled and custom previews</h3>
<br>
<ks-carousel [id]="301" [images]="imagesRect"
[carouselConfig]="{maxWidth: '766px', maxHeight: '400px', showArrows: true, objectFit: 'cover', keyboardEnable: true, modalGalleryEnable: false, legacyIE11Mode: true}"
[previewConfig]="{visible: true, number: 5, width: 'auto', maxHeight: '100px'}">
[carouselConfig]="{maxWidth: '766px', maxHeight: '400px', showArrows: true, objectFit: 'cover', keyboardEnable: true, modalGalleryEnable: false, legacyIE11Mode: true}"
[previewConfig]="{visible: true, number: 5, width: 'auto', maxHeight: '100px'}">
<div class="projected">This is my projected content!</div>
</ks-carousel>
</section>
Expand All @@ -29,8 +29,8 @@ <h3>D2 - (id=301) - carousel example for IE11 with fixed maxWidth (766px), legac
<h3>D3 - (id=302) - carousel example for IE11 with description and legacyMode enabled</h3>
<br>
<ks-carousel [id]="302" [images]="imagesRect"
[carouselConfig]="{maxWidth: '100%', maxHeight: '400px', showArrows: true, objectFit: 'cover', keyboardEnable: true, modalGalleryEnable: false, legacyIE11Mode: true}"
[carouselImageConfig]="{description: {strategy: 2}}">
[carouselConfig]="{maxWidth: '100%', maxHeight: '400px', showArrows: true, objectFit: 'cover', keyboardEnable: true, modalGalleryEnable: false, legacyIE11Mode: true}"
[carouselImageConfig]="{description: {strategy: 2}}">
<div class="projected">This is my projected content!</div>
</ks-carousel>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,7 @@ $background: rgba(0, 0, 0, .7);
width: 100%;
pointer-events: none;
}

.title {
margin-top: 40px;
}
8 changes: 4 additions & 4 deletions examples/angular-cli-6/src/app/carousel/carousel.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2 class="title">Carousel</h2>
<hr>
<br>

<p class="red-text">ATTENTION! Carousel supports Internet Explorer 11 only if you enable legacy mode.
For more info, please check the <a href="https://ks89.github.io/angular-modal-gallery-2018-v7.github.io/features/modal-gallery">official documentation</a>
Expand Down Expand Up @@ -87,9 +87,9 @@ <h3>A9 - (id=108) - carousel example with buttons to enable/disable autoplay, ar
<h3>A10 - (id=109) - carousel example (minimal with all defaults) with outputs</h3>
<br>
<ks-carousel [id]="109" [images]="imagesRect"
(show)="onShow($event)"
(firstImage)="onFirstImage($event)"
(lastImage)="onLastImage($event)"></ks-carousel>
(show)="onShow($event)"
(firstImage)="onFirstImage($event)"
(lastImage)="onLastImage($event)"></ks-carousel>
</section>
<br>
<br>
Expand Down
4 changes: 4 additions & 0 deletions examples/angular-cli-6/src/app/carousel/carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,7 @@ $background: rgba(0, 0, 0, .7);
width: 100%;
pointer-events: none;
}

.title {
margin-top: 40px;
}
176 changes: 176 additions & 0 deletions examples/angular-cli-6/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/*
The MIT License (MIT)
Copyright (c) 2017-2018 Stefano Cappa (Ks89)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

import { Component } from '@angular/core';

import { AccessibilityConfig, Image, ImageEvent } from '@ks89/angular-modal-gallery';

@Component({
selector: 'ks-home-page',
templateUrl: './home.html',
styleUrls: ['./home.scss']
})
export class HomeComponent {
imageIndex = 1;
galleryId = 1;
autoPlay = true;
showArrows = true;
showDots = true;

imagesRect: Image[] = [
new Image(
0,
{
img: '/assets/images/gallery/milan-pegasus-gallery-statue.jpg',
description: 'Description 1'
},
{
img: '/assets/images/gallery/thumbs/t-milan-pegasus-gallery-statue.jpg',
title: 'First image title',
alt: 'First image alt',
ariaLabel: 'First image aria-label'
}
),
new Image(1, { img: '/assets/images/gallery/pexels-photo-47223.jpeg' }, { img: '/assets/images/gallery/thumbs/t-pexels-photo-47223.jpg' }),
new Image(
2,
{
img: '/assets/images/gallery/pexels-photo-52062.jpeg',
description: 'Description 3',
title: 'Third image title',
alt: 'Third image alt',
ariaLabel: 'Third image aria-label'
},
{
img: '/assets/images/gallery/thumbs/t-pexels-photo-52062.jpg',
description: 'Description 3'
}
),
new Image(
3,
{
img: '/assets/images/gallery/pexels-photo-66943.jpeg',
description: 'Description 4',
title: 'Fourth image title (modal obj)',
alt: 'Fourth image alt (modal obj)',
ariaLabel: 'Fourth image aria-label (modal obj)'
},
{
img: '/assets/images/gallery/thumbs/t-pexels-photo-66943.jpg',
title: 'Fourth image title (plain obj)',
alt: 'Fourth image alt (plain obj)',
ariaLabel: 'Fourth image aria-label (plain obj)'
}
),
new Image(4, { img: '/assets/images/gallery/pexels-photo-93750.jpeg' }, { img: '/assets/images/gallery/thumbs/t-pexels-photo-93750.jpg' }),
new Image(
5,
{
img: '/assets/images/gallery/pexels-photo-94420.jpeg',
description: 'Description 6'
},
{ img: '/assets/images/gallery/thumbs/t-pexels-photo-94420.jpg' }
),
new Image(6, { img: '/assets/images/gallery/pexels-photo-96947.jpeg' }, { img: '/assets/images/gallery/thumbs/t-pexels-photo-96947.jpg' })
];

accessibilityConfig: AccessibilityConfig = {
backgroundAriaLabel: 'CUSTOM Modal gallery full screen background',
backgroundTitle: 'CUSTOM background title',

plainGalleryContentAriaLabel: 'CUSTOM Plain gallery content',
plainGalleryContentTitle: 'CUSTOM plain gallery content title',

modalGalleryContentAriaLabel: 'CUSTOM Modal gallery content',
modalGalleryContentTitle: 'CUSTOM modal gallery content title',

loadingSpinnerAriaLabel: 'CUSTOM The current image is loading. Please be patient.',
loadingSpinnerTitle: 'CUSTOM The current image is loading. Please be patient.',

mainContainerAriaLabel: 'CUSTOM Current image and navigation',
mainContainerTitle: 'CUSTOM main container title',
mainPrevImageAriaLabel: 'CUSTOM Previous image',
mainPrevImageTitle: 'CUSTOM Previous image',
mainNextImageAriaLabel: 'CUSTOM Next image',
mainNextImageTitle: 'CUSTOM Next image',

dotsContainerAriaLabel: 'CUSTOM Image navigation dots',
dotsContainerTitle: 'CUSTOM dots container title',
dotAriaLabel: 'CUSTOM Navigate to image number',

previewsContainerAriaLabel: 'CUSTOM Image previews',
previewsContainerTitle: 'CUSTOM previews title',
previewScrollPrevAriaLabel: 'CUSTOM Scroll previous previews',
previewScrollPrevTitle: 'CUSTOM Scroll previous previews',
previewScrollNextAriaLabel: 'CUSTOM Scroll next previews',
previewScrollNextTitle: 'CUSTOM Scroll next previews',

carouselContainerAriaLabel: 'Current image and navigation',
carouselContainerTitle: '',
carouselPrevImageAriaLabel: 'Previous image',
carouselPrevImageTitle: 'Previous image',
carouselNextImageAriaLabel: 'Next image',
carouselNextImageTitle: 'Next image',
carouselDotsContainerAriaLabel: 'Image navigation dots',
carouselDotsContainerTitle: '',
carouselDotAriaLabel: 'Navigate to image number',
carouselPreviewsContainerAriaLabel: 'Image previews',
carouselPreviewsContainerTitle: '',
carouselPreviewScrollPrevAriaLabel: 'Scroll previous previews',
carouselPreviewScrollPrevTitle: 'Scroll previous previews',
carouselPreviewScrollNextAriaLabel: 'Scroll next previews',
carouselPreviewScrollNextTitle: 'Scroll next previews'
};

addRandomImage() {
const imageToCopy: Image = this.imagesRect[Math.floor(Math.random() * this.imagesRect.length)];
const newImage: Image = new Image(this.imagesRect.length - 1 + 1, imageToCopy.modal, imageToCopy.plain);
this.imagesRect = [...this.imagesRect, newImage];
}

onChangeAutoPlay() {
this.autoPlay = !this.autoPlay;
}

onChangeShowArrows() {
this.showArrows = !this.showArrows;
}

onChangeShowDots() {
this.showDots = !this.showDots;
}

// output evets
onShow(event: ImageEvent) {
console.log('show', event);
}

onFirstImage(event: ImageEvent) {
console.log('firstImage', event);
}

onLastImage(event: ImageEvent) {
console.log('lastImage', event);
}
}
12 changes: 12 additions & 0 deletions examples/angular-cli-6/src/app/home/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<ks-intro-header></ks-intro-header>
<br>

<section class="container">
<h2>Welcome</h2>
<p class="lead">This is the official live example of @ks89/angular-modal-gallery.
To get started quickly you can try and check the <a href="https://github.com/Ks89/angular-modal-gallery/tree/master/src">sourcecode of this example</a>.</p>
<p>If you need the <b>full documentation with all apis, <a href="https://ks89.github.io/angular-modal-gallery-2018-v7.github.io/">this is the official documentation website</a></b>.</p>

<p>The official documentation is available at <a href="https://ks89.github.io/angular-modal-gallery-2018-v7.github.io/">ks89.github.io/angular-modal-gallery-2018-v7.github.io</a></p>
</section>

0 comments on commit 6fe15d2

Please sign in to comment.