From 7a4f96125389c6374c0079988c0cd9546e089117 Mon Sep 17 00:00:00 2001 From: Mariela Tihova Date: Mon, 26 Jan 2026 18:26:51 +0200 Subject: [PATCH 1/2] fix(circular-progress): Fix interactive part of the sample --- .../src/DynamicCircularProgressStyle.css | 17 ++++ .../dynamic/src/index.tsx | 93 +++++++------------ 2 files changed, 52 insertions(+), 58 deletions(-) diff --git a/samples/inputs/circular-progress-indicator/dynamic/src/DynamicCircularProgressStyle.css b/samples/inputs/circular-progress-indicator/dynamic/src/DynamicCircularProgressStyle.css index b5b21b6e2f..e05d779cfd 100644 --- a/samples/inputs/circular-progress-indicator/dynamic/src/DynamicCircularProgressStyle.css +++ b/samples/inputs/circular-progress-indicator/dynamic/src/DynamicCircularProgressStyle.css @@ -1,4 +1,21 @@ igc-circular-progress { --diameter: 100px; --stroke-thickness: 5px; +} + +.sample-content { + width: 300px; + display: flex; + align-items: center; + margin-top: 30px; +} + +.circular-progress-container { + margin-right: 50px; + margin-left: 20px; +} + +.buttons-container { + display: flex; + gap: 10px; } \ No newline at end of file diff --git a/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx b/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx index 92eee138bc..4120f6087d 100644 --- a/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx +++ b/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import { IgrCircularProgress, IgrCircularGradient, IgrIconButton, IgrCircularProgressModule, IgrCircularGradientModule, IgrIconButtonModule, registerIconFromText } from 'igniteui-react'; @@ -12,70 +12,47 @@ IgrIconButtonModule.register(); const addIconText = ''; const removeIconText = ''; -export default class DynamicCircularProgress extends React.Component { +export default function DynamicCircularProgress() { - public circularProgress: IgrCircularProgress; - public addIcon: IgrIconButton; - public removeIcon: IgrIconButton; + const [currentValue, setCurrentValue] = useState(0); - constructor(props: any) { - super(props); + useEffect(() => { + registerIconFromText("add", addIconText, "material"); + registerIconFromText("remove", removeIconText, "material"); + }, []); - registerIconFromText( - "add", addIconText, "material" - ); - registerIconFromText( - "remove", removeIconText, "material" - ); - - this.circularProgressRef = this.circularProgressRef.bind(this); - this.onIconClick = this.onIconClick.bind(this); - } - - public render(): JSX.Element { - return ( -
- - - - - - - - -
- - - - -
-
- ); - } - - public circularProgressRef(progress: IgrCircularProgress) - { - if(!progress) { return; } - this.circularProgress = progress; + const incrementProgress = () => { + setCurrentValue(currentValue + 10); + if (currentValue > 100) { + setCurrentValue(100); + } } - public onIconClick(e: any) { - const target = e.target as HTMLElement; - const iconButton: any = target.closest('igc-icon-button'); - if(iconButton.getAttribute("classname") === "removeIcon") - { - if(this.circularProgress.value > 0) { - this.circularProgress.value = this.circularProgress.value - 10; - } - else { - this.circularProgress.value = 0; - } - } - else { - this.circularProgress.value = this.circularProgress.value + 10; + const decrementProgress = () => { + setCurrentValue(currentValue - 10); + if (currentValue < 0) { + setCurrentValue(0); } - } + + return ( +
+ + + + + + + + +
+ + + + +
+
+ ); } // rendering above class to the React DOM From dd0dcc55f865c0ef38a0f8df037d72c8f7f38fe8 Mon Sep 17 00:00:00 2001 From: Mariela Tihova Date: Fri, 30 Jan 2026 14:22:33 +0200 Subject: [PATCH 2/2] fix(circular-progress): Edit increment and decrement to handle state correctly --- .../dynamic/src/index.tsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx b/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx index 4120f6087d..9ec6e04d48 100644 --- a/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx +++ b/samples/inputs/circular-progress-indicator/dynamic/src/index.tsx @@ -22,17 +22,23 @@ export default function DynamicCircularProgress() { }, []); const incrementProgress = () => { - setCurrentValue(currentValue + 10); - if (currentValue > 100) { - setCurrentValue(100); - } + setCurrentValue((oldValue) => { + const newValue = oldValue + 10; + if (newValue > 100) { + return 100; + } + return newValue; + }); } const decrementProgress = () => { - setCurrentValue(currentValue - 10); - if (currentValue < 0) { - setCurrentValue(0); - } + setCurrentValue((oldValue) => { + const newValue = oldValue - 10; + if (newValue < 0) { + return 0; + } + return newValue; + }); } return (