-
bannerRef.current.hide()}>
-
- Continue Offline
+
+ You have lost connection to the internet. This app is offline.
+
+ bannerRef.current.hide()}>
+
+ Continue Offline
- refreshBanner()}>
-
- Turn On Wifi
+
+
+ Turn On Wifi
-
-
+
+
-
-
+
+
- {`Wifi is now ${wifiState ? 'on' : 'off'}`}
+ {`Wifi is now ${wifiState ? 'on' : 'off'}`}
@@ -108,4 +95,4 @@ export default function BannerAdvancedSample() {
// rendering above class to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
-root.render( );
+root.render( );
diff --git a/samples/notifications/banner/banner-sample-1/src/index.tsx b/samples/notifications/banner/banner-sample-1/src/index.tsx
index 637a946dd..7d8b54d56 100644
--- a/samples/notifications/banner/banner-sample-1/src/index.tsx
+++ b/samples/notifications/banner/banner-sample-1/src/index.tsx
@@ -2,24 +2,15 @@ import React, { useEffect, useRef } from 'react';
import ReactDOM from 'react-dom/client';
import {
IgrBanner,
- IgrBannerModule,
IgrCard,
- IgrCardModule,
IgrIcon,
- IgrIconModule,
IgrNavbar,
- IgrNavbarModule,
registerIconFromText,
- } from 'igniteui-react';
+} from 'igniteui-react';
import 'igniteui-webcomponents/themes/light/bootstrap.css';
import './BannerSample1.css';
import './index.css';
-IgrBannerModule.register();
-IgrNavbarModule.register();
-IgrIconModule.register();
-IgrCardModule.register();
-
const refreshIcon =
' ';
@@ -35,22 +26,22 @@ export default function BannerSample1() {
- Gallery
- bannerRef.current.show()}>
+ Gallery
+ bannerRef.current.show()}>
- You are currently offline.
+ You are currently offline.
-
+
-
-
+
+
-
-
+
+
@@ -60,4 +51,4 @@ export default function BannerSample1() {
// rendering above class to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
-root.render( );
+root.render( );
diff --git a/samples/notifications/banner/banner-sample-2/src/index.tsx b/samples/notifications/banner/banner-sample-2/src/index.tsx
index 6f12872ae..9b0e616dc 100644
--- a/samples/notifications/banner/banner-sample-2/src/index.tsx
+++ b/samples/notifications/banner/banner-sample-2/src/index.tsx
@@ -2,30 +2,17 @@ import React, { useEffect, useRef } from 'react';
import ReactDOM from 'react-dom/client';
import {
IgrBanner,
- IgrBannerModule,
IgrButton,
- IgrButtonModule,
IgrCard,
- IgrCardModule,
IgrIcon,
- IgrIconModule,
IgrNavbar,
- IgrNavbarModule,
IgrRipple,
- IgrRippleModule,
registerIconFromText,
- } from 'igniteui-react';
+} from 'igniteui-react';
import 'igniteui-webcomponents/themes/light/bootstrap.css';
import './BannerSample2.css';
import './index.css';
-IgrBannerModule.register();
-IgrNavbarModule.register();
-IgrIconModule.register();
-IgrCardModule.register();
-IgrButtonModule.register();
-IgrRippleModule.register();
-
const refreshIcon =
' ';
const wifiOffIcon =
@@ -44,29 +31,29 @@ export default function BannerSample2() {
- Gallery
- bannerRef.current.show()}>
+ Gallery
+ bannerRef.current.show()}>
-
- You have lost connection to the internet. This app is offline.
-
-
bannerRef.current.toggle()}>
-
- Toggle Banner
+
+ You have lost connection to the internet. This app is offline.
+
+ bannerRef.current.toggle()}>
+
+ Toggle Banner
-
-
+
+
-
-
+
+
@@ -76,4 +63,4 @@ export default function BannerSample2() {
// rendering above class to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
-root.render( );
+root.render( );
diff --git a/samples/notifications/banner/banner-styling/src/index.tsx b/samples/notifications/banner/banner-styling/src/index.tsx
index 8cd3de597..671d5ca5f 100644
--- a/samples/notifications/banner/banner-styling/src/index.tsx
+++ b/samples/notifications/banner/banner-styling/src/index.tsx
@@ -2,33 +2,18 @@ import React, { useEffect, useRef, useState } from 'react';
import ReactDOM from 'react-dom/client';
import {
IgrBanner,
- IgrBannerModule,
IgrButton,
- IgrButtonModule,
IgrCard,
- IgrCardModule,
IgrIcon,
- IgrIconModule,
IgrNavbar,
- IgrNavbarModule,
IgrRipple,
- IgrRippleModule,
IgrToast,
- IgrToastModule,
registerIconFromText,
- } from 'igniteui-react';
+} from 'igniteui-react';
import 'igniteui-webcomponents/themes/light/bootstrap.css';
import './BannerStyling.css';
import './index.css';
-IgrBannerModule.register();
-IgrNavbarModule.register();
-IgrIconModule.register();
-IgrCardModule.register();
-IgrButtonModule.register();
-IgrRippleModule.register();
-IgrToastModule.register();
-
const wifiOnIcon =
' ';
const wifiOffIcon =
@@ -40,6 +25,7 @@ export default function BannerStyling() {
const toastRef = useRef(null);
const [wifiState, setWifiState] = useState(false);
+ const [iconName, setIconName] = useState("signal_wifi_off");
useEffect(() => {
registerIconFromText('signal_wifi_off', wifiOffIcon);
@@ -47,20 +33,21 @@ export default function BannerStyling() {
bannerRef.current.open = true;
}, []);
- function refreshBanner() {
- if (!wifiState) {
- iconRef.current.name = 'signal_wifi_4_bar';
+ const refreshBanner = () => {
+ const nextWifiState = !wifiState;
+ setWifiState(nextWifiState);
+ setIconName(nextWifiState ? "signal_wifi_4_bar" : "signal_wifi_off");
+
+ if (nextWifiState) {
bannerRef.current.hide();
} else {
- iconRef.current.name = 'signal_wifi_off';
bannerRef.current.show();
}
- setWifiState(current => !current);
showToast();
}
- function showToast() {
+ const showToast = () => {
toastRef.current.open = false;
toastRef.current.show();
}
@@ -69,37 +56,37 @@ export default function BannerStyling() {
- Gallery
- refreshBanner()}>
+ Gallery
+
-
- You have lost connection to the internet. This app is offline.
-
-
bannerRef.current.hide()}>
-
- Continue Offline
+
+ You have lost connection to the internet. This app is offline.
+
+ bannerRef.current.hide()}>
+
+ Continue Offline
- refreshBanner()}>
-
- Turn On Wifi
+
+
+ Turn On Wifi
-
-
+
+
-
-
+
+
- {`Wifi is now ${wifiState ? 'on' : 'off'}`}
+ {`Wifi is now ${wifiState ? 'on' : 'off'}`}
@@ -108,4 +95,4 @@ export default function BannerStyling() {
// rendering above class to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
-root.render( );
+root.render( );