|
| 1 | +import { DxcParagraph, DxcBulletedList, DxcFlex } from "@dxc-technology/halstack-react"; |
| 2 | +import QuickNavContainer from "@/common/QuickNavContainer"; |
| 3 | +import QuickNavContainerLayout from "@/common/QuickNavContainerLayout"; |
| 4 | +import DocFooter from "@/common/DocFooter"; |
| 5 | +import Image from "@/common/Image"; |
| 6 | +import Example from "@/common/example/Example"; |
| 7 | +import default_overlay from "./images/default_overlay.png"; |
| 8 | +import anatomy from "./images/progress_bar_anatomy.png"; |
| 9 | +import determinate_undeterminate from "./examples/determinate_undeterminate"; |
| 10 | + |
| 11 | +const sections = [ |
| 12 | + { |
| 13 | + title: "Introduction", |
| 14 | + content: ( |
| 15 | + <DxcParagraph> |
| 16 | + Progress bars are used to show the progression of a task over time. They provide users with immediate visual |
| 17 | + feedback about the current state of an operation, such as loading content, uploading a file, or completing a |
| 18 | + form. |
| 19 | + </DxcParagraph> |
| 20 | + ), |
| 21 | + }, |
| 22 | + { |
| 23 | + title: "Anatomy", |
| 24 | + content: ( |
| 25 | + <> |
| 26 | + <Image src={anatomy} alt="Progress bar's anatomy" /> |
| 27 | + <DxcBulletedList type="number"> |
| 28 | + <DxcBulletedList.Item> |
| 29 | + <strong>Label</strong> <em>(Optional)</em>: text element that describes the purpose or context of the |
| 30 | + progress bar (e.g., "Uploading file…"). |
| 31 | + </DxcBulletedList.Item> |
| 32 | + <DxcBulletedList.Item> |
| 33 | + <strong>Helper text</strong> <em>(Optional)</em>: provides additional information or clarification related |
| 34 | + to the progress, such as status messages or expected duration. |
| 35 | + </DxcBulletedList.Item> |
| 36 | + <DxcBulletedList.Item> |
| 37 | + <strong>Progress track line:</strong> the filled portion of the bar showing completed progress. |
| 38 | + </DxcBulletedList.Item> |
| 39 | + <DxcBulletedList.Item> |
| 40 | + <strong>Progress total line:</strong> the background bar representing the total task to be completed. |
| 41 | + </DxcBulletedList.Item> |
| 42 | + <DxcBulletedList.Item> |
| 43 | + <strong>Progress indicator</strong> <em>(Optional)</em>: highlights the current progress value within the |
| 44 | + bar. |
| 45 | + </DxcBulletedList.Item> |
| 46 | + </DxcBulletedList> |
| 47 | + </> |
| 48 | + ), |
| 49 | + }, |
| 50 | + { |
| 51 | + title: "Variants", |
| 52 | + content: ( |
| 53 | + <> |
| 54 | + <DxcParagraph>Progress bars come in different styles based on task nature and UI context.</DxcParagraph> |
| 55 | + </> |
| 56 | + ), |
| 57 | + subSections: [ |
| 58 | + { |
| 59 | + title: "Default or overlay", |
| 60 | + content: ( |
| 61 | + <> |
| 62 | + <DxcBulletedList> |
| 63 | + <DxcBulletedList.Item> |
| 64 | + <strong>Default:</strong> displays the progress bar inline, directly within the page or component |
| 65 | + layout. This is the most commonly used style, suitable for non-blocking tasks that allow the user to |
| 66 | + continue interacting with the UI. |
| 67 | + </DxcBulletedList.Item> |
| 68 | + <DxcBulletedList.Item> |
| 69 | + <strong>Overlay:</strong> displays the progress with a background overlay, temporarily blocking |
| 70 | + interaction with the UI. It's used for tasks that require user attention or when interaction must be |
| 71 | + paused until the task is complete. |
| 72 | + </DxcBulletedList.Item> |
| 73 | + </DxcBulletedList> |
| 74 | + <Image src={default_overlay} alt="Default mode and overlay mode example" /> |
| 75 | + </> |
| 76 | + ), |
| 77 | + }, |
| 78 | + { |
| 79 | + title: "Determinate or indeterminate", |
| 80 | + content: ( |
| 81 | + <> |
| 82 | + <DxcBulletedList> |
| 83 | + <DxcBulletedList.Item> |
| 84 | + <strong>Determinate:</strong> are used when the system can calculate the percentage of work completed. |
| 85 | + </DxcBulletedList.Item> |
| 86 | + <DxcBulletedList.Item> |
| 87 | + <strong>Indeterminate:</strong> are used when the duration of the task is unknown or unpredictable. |
| 88 | + </DxcBulletedList.Item> |
| 89 | + </DxcBulletedList> |
| 90 | + <Example example={determinate_undeterminate} /> |
| 91 | + </> |
| 92 | + ), |
| 93 | + }, |
| 94 | + ], |
| 95 | + }, |
| 96 | + { |
| 97 | + title: "Best practices", |
| 98 | + content: ( |
| 99 | + <> |
| 100 | + <DxcBulletedList> |
| 101 | + <DxcBulletedList.Item> |
| 102 | + <strong>Provide clear feedback:</strong> always display a progress bar when the task takes longer than a few |
| 103 | + seconds. This reassures users that the system is processing and gives them a sense of control. If possible, |
| 104 | + include a label or percentage to indicate how much of the task is completed. |
| 105 | + </DxcBulletedList.Item> |
| 106 | + <DxcBulletedList.Item> |
| 107 | + <strong>Avoid overuse:</strong> don't show a progress bar for tasks shorter than 1 second — use a spinner or |
| 108 | + no feedback instead. Don't use a progress bar just for decoration; it should always reflect a real process. |
| 109 | + </DxcBulletedList.Item> |
| 110 | + <DxcBulletedList.Item> |
| 111 | + <strong>Provide contextual information:</strong> whenever possible, provide additional information like |
| 112 | + "Starting," "Halfway," or "Almost Done" to help users gauge the task status. If applicable, show what the |
| 113 | + task involves, especially when the user is waiting for something critical (e.g., "Updating to the latest |
| 114 | + version..."). |
| 115 | + </DxcBulletedList.Item> |
| 116 | + <DxcBulletedList.Item> |
| 117 | + <strong>Use the right variant:</strong> use determinate when the completion percentage is known (e.g., file |
| 118 | + uploads, task completion). Use indeterminate when the system can’t predict the time or progress (e.g., |
| 119 | + loading content, waiting for server responses). |
| 120 | + </DxcBulletedList.Item> |
| 121 | + <DxcBulletedList.Item> |
| 122 | + <strong>Avoid blocking the UI:</strong> when progress is happening in the background, place the progress bar |
| 123 | + in a non-intrusive area, like near the top of the page or inside a specific section. Use overlay variant |
| 124 | + only when necessary, as it blocks user interaction. Make sure to include a clear indication of what the user |
| 125 | + is waiting for and an estimated time if possible. |
| 126 | + </DxcBulletedList.Item> |
| 127 | + <DxcBulletedList.Item> |
| 128 | + <strong>Combine with other feedback:</strong> pair with success, warning, or info toasts or alerts when |
| 129 | + appropriate to give users closure after completion. |
| 130 | + </DxcBulletedList.Item> |
| 131 | + </DxcBulletedList> |
| 132 | + </> |
| 133 | + ), |
| 134 | + }, |
| 135 | +]; |
| 136 | + |
| 137 | +const ProgressBarOverviewPage = () => ( |
| 138 | + <DxcFlex direction="column" gap="4rem"> |
| 139 | + <QuickNavContainerLayout> |
| 140 | + <QuickNavContainer sections={sections} startHeadingLevel={2} /> |
| 141 | + </QuickNavContainerLayout> |
| 142 | + <DocFooter githubLink="https://github.com/dxc-technology/halstack-react/blob/master/apps/website/screens/components/progress-bar/overview/ProgressBarOverviewPage.tsx" /> |
| 143 | + </DxcFlex> |
| 144 | +); |
| 145 | + |
| 146 | +export default ProgressBarOverviewPage; |
0 commit comments