Skip to content

Commit 98f6304

Browse files
Merge pull request #745 from IgniteUI/rivanova/banner-samples
Add Banner samples
2 parents 8fb32c2 + 872b6f9 commit 98f6304

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1570
-0
lines changed

browser/public/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,13 @@
10181018
</div>
10191019

10201020
<div class="nav-group">NOTIFICATIONS</div>
1021+
<label id="nav-banner" class="nav-component">Banner</label>
1022+
<div id="nav-banner-list" class="nav-list" state="collapsed">
1023+
<a class="nav-link" href="#" data-nav="/samples/notifications/banner/banner-advanced-sample"><span>Advanced Sample</span></a>
1024+
<a class="nav-link" href="#" data-nav="/samples/notifications/banner/banner-sample-1"><span>Sample1</span></a>
1025+
<a class="nav-link" href="#" data-nav="/samples/notifications/banner/banner-sample-2"><span>Sample2</span></a>
1026+
<a class="nav-link" href="#" data-nav="/samples/notifications/banner/banner-styling"><span>Styling</span></a>
1027+
</div>
10211028
<label id="nav-dialog" class="nav-component">Dialog</label>
10221029
<div id="nav-dialog-list" class="nav-list" state="collapsed">
10231030
<a class="nav-link" href="#" data-nav="/samples/notifications/dialog/closing-variations"><span>Closing Variations</span></a>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 250,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"trailingComma": "none",
8+
"bracketSpacing": true,
9+
"jsxBracketSameLine": false,
10+
"fluid": false
11+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!-- NOTE: do not change this file because it's auto re-generated from template: -->
2+
<!-- https://github.com/IgniteUI/igniteui-wc-examples/tree/vnext/templates/browser/sample/ReadMe.md -->
3+
4+
This folder contains implementation of Web Components application with example of Advanced Sample feature using [Banner](https://infragistics.com/webcomponentssite/components/general-getting-started.html) component.
5+
6+
7+
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
8+
<body>
9+
<a target="_blank" href="https://infragistics.com/webcomponentssite/components/general-getting-started.html" rel="noopener noreferrer">
10+
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-docs.png"/>
11+
</a>
12+
<a target="_blank" href="./src/index.ts" rel="noopener noreferrer">
13+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-code.png"/>
14+
</a>
15+
<a target="_blank" href="https://www.infragistics.com/webcomponents-demos/samples/notifications/banner/banner-advanced-sample" rel="noopener noreferrer">
16+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-run.png"/>
17+
</a>
18+
<a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-wc-examples/tree/master/samples/notifications/banner/banner-advanced-sample?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/{SampleFile}" rel="noopener noreferrer">
19+
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-sandbox.png"/>
20+
</a>
21+
</body>
22+
</html>
23+
24+
## Branches
25+
26+
> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-angular-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-angular-examples/tree/vnext) branch only when you want to contribute new samples to this repository.
27+
28+
## Instructions
29+
30+
To set up this project locally, execute these commands:
31+
32+
```
33+
git clone https://github.com/IgniteUI/igniteui-wc-examples.git
34+
git checkout master
35+
cd ./igniteui-wc-examples
36+
cd ./samples/notifications/banner/banner-advanced-sample
37+
```
38+
39+
open above folder in VS Code or type:
40+
```
41+
code .
42+
```
43+
44+
In terminal window, run:
45+
46+
```
47+
npm install
48+
npm run start
49+
```
50+
51+
Then open http://localhost:4200/ in your browser
52+
53+
54+
## Learn More
55+
56+
To learn more about **Ignite UI for Web Components**, check out the [Web Components documentation](https://infragistics.com/webcomponentssite/components/general-getting-started.html).
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<html>
2+
3+
<head>
4+
<title>Banner Advanced Sample</title>
5+
<meta charset="UTF-8" />
6+
7+
<link rel="shortcut icon" href="https://static.infragistics.com/xplatform/images/browsers/wc.png">
8+
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
9+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
10+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium Web" />
11+
<link rel="stylesheet" href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type="text/css" />
12+
</head>
13+
14+
<body>
15+
<div id="root">
16+
<div class="gallery__wrapper">
17+
<div class="gallery__content">
18+
<igc-navbar>
19+
<h1>Gallery</h1>
20+
<igc-icon id="icon" name="signal_wifi_off" slot="end" size="large"></igc-icon>
21+
</igc-navbar>
22+
23+
<igc-banner id="banner" class="offline-banner">
24+
<igc-icon name="signal_wifi_off" slot="prefix" size="large"></igc-icon>
25+
You have lost connection to the internet. This app is offline.
26+
<div slot="actions">
27+
<igc-button variant="flat" onclick="banner.hide()">
28+
<igc-ripple></igc-ripple>
29+
Continue Offline
30+
</igc-button>
31+
<igc-button id="button" variant="flat">
32+
<igc-ripple></igc-ripple>
33+
Turn On Wifi
34+
</igc-button>
35+
</div>
36+
</igc-banner>
37+
38+
<igc-card class="gallery__item" elevated>
39+
<div>
40+
<img src="https://www.infragistics.com/angular-demos-lob/assets/images/card/media/the_red_ice_forest.jpg">
41+
</div>
42+
</igc-card>
43+
<igc-card class="gallery__item" elevated>
44+
<div>
45+
<img src="https://www.infragistics.com/angular-demos-lob/assets/images/card/media/yosemite.jpg">
46+
</div>
47+
</igc-card>
48+
49+
<igc-toast id="toast" position="middle"></igc-toast>
50+
</div>
51+
</div>
52+
53+
</div>
54+
55+
<!-- This script is needed only for parcel and it will be excluded for webpack -->
56+
<% if (false) { %>
57+
<script src="src/index.ts"></script>
58+
<% } %>
59+
60+
</body>
61+
62+
</html>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "wc-banner-advanced-sample",
3+
"version": "1.0.0",
4+
"description": "This project provides example of Banner Advanced Sample using IgniteUI for Web Components",
5+
"main": "src/index.ts",
6+
"scripts": {
7+
"build": "npm run build:prod",
8+
"build:dev": "webpack --mode development --config ./webpack.config.js --progress --color --display-error-details",
9+
"build:prod": "webpack --env.NODE_ENV=production --mode production --config ./webpack.config.js --progress --color --display-error-details --bail",
10+
"serve:dev": "node --max-old-space-size=8192 node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode development --config ./webpack.config.js --hot --progress --open",
11+
"serve:prod": "webpack-dev-server --env.NODE_ENV=production --mode production --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --progress --open --content-base dist/",
12+
"start": "npm run serve:dev",
13+
"build:legacy": "npm run build:prod:legacy",
14+
"build:dev:legacy": "webpack --env.legacy=true --mode development --config ./webpack.config.js --progress --color --display-error-details",
15+
"build:prod:legacy": "webpack --env.NODE_ENV=production --env.legacy=true --mode production --config ./webpack.config.js --progress --color --display-error-details --bail",
16+
"serve:dev:legacy": "node --max-old-space-size=8192 node_modules/webpack-dev-server/bin/webpack-dev-server.js --env.legacy=true --mode development --config ./webpack.config.js --hot --progress --open",
17+
"serve:prod:legacy": "webpack-dev-server --env.NODE_ENV=production --env.legacy=true --mode production --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --progress --open --content-base dist/",
18+
"start:legacy": "npm run serve:dev:legacy"
19+
},
20+
"author": "Infragistics",
21+
"dependencies": {
22+
"@webcomponents/custom-elements": "^1.4.1",
23+
"@webcomponents/template": "^1.4.2",
24+
"babel-runtime": "^6.26.0",
25+
"core-js": "^3.6.5",
26+
"igniteui-webcomponents": "4.11.1",
27+
"lit": "^2.0.2",
28+
"lit-html": "^2.2.0",
29+
"tslib": "^2.0.0"
30+
},
31+
"devDependencies": {
32+
"@babel/cli": "^7.8.3",
33+
"@babel/core": "^7.8.3",
34+
"@babel/plugin-proposal-class-properties": "^7.8.3",
35+
"@babel/plugin-transform-runtime": "^7.10.0",
36+
"@babel/preset-env": "^7.8.3",
37+
"@babel/preset-typescript": "^7.8.3",
38+
"@types/source-map": "^0.5.7",
39+
"babel-loader": "^8.1.0",
40+
"babel-plugin-transform-custom-element-classes": "^0.1.0",
41+
"css-loader": "^1.0.0",
42+
"csv-loader": "^3.0.2",
43+
"file-loader": "^4.2.0",
44+
"fork-ts-checker-webpack-plugin": "^4.1.5",
45+
"html-webpack-plugin": "^4.3.0",
46+
"parcel-bundler": "^1.6.1",
47+
"source-map": "^0.7.3",
48+
"style-loader": "^0.22.1",
49+
"tsconfig-paths-webpack-plugin": "^4.0.0",
50+
"typescript": "^4.4.4",
51+
"webpack": "^5.74.0",
52+
"webpack-cli": "^4.10.0",
53+
"webpack-dev-server": "^4.11.1",
54+
"worker-loader": "^3.0.8",
55+
"xml-loader": "^1.2.1"
56+
},
57+
"license": "",
58+
"homepage": "."
59+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"infiniteLoopProtection": false,
3+
"hardReloadOnChange": false,
4+
"view": "browser",
5+
"template": "parcel"
6+
}
7+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.offline-banner {
2+
border-bottom: 1px solid rgba(0, 0, 0, .12);
3+
}
4+
5+
.gallery__wrapper {
6+
max-width: 400px;
7+
padding-top: 24px;
8+
margin: 0 auto;
9+
}
10+
11+
.gallery__content {
12+
display: flex;
13+
flex-flow: column;
14+
max-height: 430px;
15+
overflow: hidden;
16+
box-shadow: 0 1px 3px 0 rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 2px 1px -1px rgba(0,0,0,.12);
17+
}
18+
19+
.gallery__item {
20+
margin: 8px 16px;
21+
overflow: visible;
22+
border-radius: 0;
23+
24+
& div {
25+
display: flex;
26+
justify-content: center;
27+
}
28+
}
29+
30+
img {
31+
max-width: 100%;
32+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* shared styles are loaded from: */
2+
/* https://static.infragistics.com/xplatform/css/samples */
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { defineComponents, registerIconFromText, IgcBannerComponent, IgcIconComponent, IgcCardComponent, IgcNavbarComponent, IgcButtonComponent, IgcRippleComponent, IgcToastComponent } from "igniteui-webcomponents";
2+
import "igniteui-webcomponents/themes/light/bootstrap.css";
3+
import "./BannerStyling.css";
4+
5+
defineComponents(IgcBannerComponent, IgcNavbarComponent, IgcIconComponent, IgcCardComponent, IgcButtonComponent, IgcRippleComponent, IgcToastComponent);
6+
7+
const wifiOnIcon =
8+
'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12.01 21.49L23.64 7c-.45-.34-4.93-4-11.64-4C5.28 3 .81 6.66.36 7l11.63 14.49.01.01.01-.01z"/></svg>';
9+
10+
const wifiOffIcon =
11+
'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M23.64 7c-.45-.34-4.93-4-11.64-4-1.5 0-2.89.19-4.15.48L18.18 13.8 23.64 7zm-6.6 8.22L3.27 1.44 2 2.72l2.05 2.06C1.91 5.76.59 6.82.36 7l11.63 14.49.01.01.01-.01 3.9-4.86 3.32 3.32 1.27-1.27-3.46-3.46z"/></svg>';
12+
13+
export class BannerAdvancedSample {
14+
private banner: IgcBannerComponent;
15+
private icon: IgcIconComponent;
16+
private button: IgcButtonComponent;
17+
private toast: IgcToastComponent;
18+
19+
private wifiState: boolean = false;
20+
21+
constructor() {
22+
registerIconFromText('signal_wifi_off', wifiOffIcon);
23+
registerIconFromText('signal_wifi_4_bar', wifiOnIcon);
24+
25+
this.banner = document.getElementById('banner') as IgcBannerComponent;
26+
this.icon = document.getElementById('icon') as IgcIconComponent;
27+
this.button = document.getElementById('button') as IgcButtonComponent;
28+
this.toast = document.getElementById('toast') as IgcToastComponent;
29+
30+
this.banner.open = true;
31+
32+
this.button.addEventListener('click', () => this.refreshBanner());
33+
this.icon.addEventListener('click', () => this.refreshBanner());
34+
}
35+
36+
public refreshBanner() {
37+
if (!this.wifiState) {
38+
this.icon.name = 'signal_wifi_4_bar';
39+
this.banner.hide();
40+
} else {
41+
this.icon.name = 'signal_wifi_off';
42+
this.banner.show();
43+
}
44+
45+
this.wifiState = !this.wifiState;
46+
this.showToast();
47+
}
48+
49+
public showToast() {
50+
this.toast.open = false;
51+
this.toast.textContent = `Wifi is now ${this.wifiState ? 'on' : 'off'}`;
52+
this.toast.show();
53+
}
54+
}
55+
56+
new BannerAdvancedSample();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"noImplicitReturns": true,
4+
"esModuleInterop": true,
5+
"noImplicitAny": true,
6+
"declarationDir": "dist/types",
7+
"moduleResolution": "node",
8+
"declaration": true,
9+
"target": "es2015",
10+
"module": "es2015",
11+
"strict": true
12+
},
13+
"include": [
14+
"src/**/*"
15+
],
16+
"exclude": [
17+
"node_modules",
18+
"dist"
19+
]
20+
}

0 commit comments

Comments
 (0)