Dynamic Progress Bar Component
Users are often guided through multi-step processes, such as profile setup wizards, file uploads, or complex form submissions. To enhance user experience and provide clear, immediate feedback, it's crucial to have a robust and visually informative progress bar component. This component will manage user expectations by clearly indicating the current completion status of a task, improving task engagement and reducing perceived wait times.
Your task is to implement a ProgressBar React component that can dynamically display progress, an optional label, and an error state. You will then integrate this component into a simulated application flow within App.tsx.
ProgressBar Component: Implement a functional React component named ProgressBar that accepts the following props:
progress: A number between 0 and 100, representing the completion percentage.label (optional): A string to display alongside the percentage (e.g., "Uploading files", "Step 3/5").isError (optional): A boolean indicating if the task is in an error state.progress as a horizontal bar that fills from left to right.progress prop changes.label prominently.isError is true (e.g., change the bar color to red, display "Error" instead of percentage).ProgressBar component in App.tsx to display the simulated task progress, label, and error states controlled by the provided buttons and manual input.progress value.label is provided, it should be displayed alongside the percentage (e.g., "Step 3/5: Processing... 60%").transition) when the progress value changes.isError is true, the bar should adopt a distinct visual style (e.g., a red background for the filled portion) and the textual display should clearly indicate an error (e.g., "Error").role="progressbar", aria-valuenow, aria-valuemin, aria-valuemax, aria-label) to ensure it's accessible to screen readers.ProgressBar component renders correctly with default progress (0).progress prop changes.label is displayed when provided.isError is true, the progress bar displays a distinct visual error state.Constraints
progress prop will always be a number between 0 and 100 (inclusive).currentProgress, taskLabel, and isTaskError states is already provided in App.tsx; your focus is on the ProgressBar component and its integration.useState and useEffect within App.tsx.ProgressBar component implementation, including proper prop handling and state management.Loading editor...