|
| 1 | +import { DxcBulletedList, DxcFlex, DxcParagraph } 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 Figure from "@/common/Figure"; |
| 6 | +import Image from "@/common/Image"; |
| 7 | +import content from "./images/dialog_content.png"; |
| 8 | +import overlay from "./images/dialog_overlay.png"; |
| 9 | +import anatomy from "./images/dialog_anatomy.png"; |
| 10 | + |
| 11 | +const sections = [ |
| 12 | + { |
| 13 | + title: "Introduction", |
| 14 | + content: ( |
| 15 | + <DxcParagraph> |
| 16 | + The <strong>dialog</strong> component is a modal window that{" "} |
| 17 | + <strong>captures user attention for critical interactions</strong>, such as confirmations, alerts, or form |
| 18 | + inputs. It appears above the main content and requires user action before continuing. To maintain usability, |
| 19 | + dialogs should be concise, focused on a single task, and provide clear actions like confirmation or dismissal. |
| 20 | + </DxcParagraph> |
| 21 | + ), |
| 22 | + }, |
| 23 | + { |
| 24 | + title: "Anatomy", |
| 25 | + content: ( |
| 26 | + <> |
| 27 | + <Image src={anatomy} alt="Dialog's anatomy" /> |
| 28 | + <DxcBulletedList type="number"> |
| 29 | + <DxcBulletedList.Item> |
| 30 | + <strong>Title:</strong> displays the main heading of the dialog, providing users with a clear and immediate |
| 31 | + understanding of its purpose |
| 32 | + </DxcBulletedList.Item> |
| 33 | + <DxcBulletedList.Item> |
| 34 | + <strong>Container:</strong> the structural wrapper that holds all dialog elements, ensuring proper |
| 35 | + alignment, spacing, and responsiveness. |
| 36 | + </DxcBulletedList.Item> |
| 37 | + <DxcBulletedList.Item> |
| 38 | + <strong>Close action:</strong> an optional button, usually represented by an “X” icon, allowing users to |
| 39 | + dismiss the dialog without completing an action. |
| 40 | + </DxcBulletedList.Item> |
| 41 | + <DxcBulletedList.Item> |
| 42 | + <strong>Content:</strong> the main area where relevant information, messages, or interactive elements (e.g., |
| 43 | + forms) are displayed. |
| 44 | + </DxcBulletedList.Item> |
| 45 | + <DxcBulletedList.Item> |
| 46 | + <strong>Actions:</strong> a set of buttons at the bottom of the dialog that guide users toward completing or |
| 47 | + canceling the intended action. |
| 48 | + </DxcBulletedList.Item> |
| 49 | + </DxcBulletedList> |
| 50 | + <DxcParagraph> |
| 51 | + <em> |
| 52 | + * Please note that while these elements are not included by default in the component's configuration, they |
| 53 | + are the expected components in a dialog. |
| 54 | + </em> |
| 55 | + </DxcParagraph> |
| 56 | + </> |
| 57 | + ), |
| 58 | + }, |
| 59 | + { |
| 60 | + title: "Placing content in a dialog", |
| 61 | + content: ( |
| 62 | + <> |
| 63 | + <Figure caption="Example of a form inside of a Halstack dialog"> |
| 64 | + <Image src={content} alt="Example of a form inside of a Halstack dialog" /> |
| 65 | + </Figure> |
| 66 | + <DxcParagraph> |
| 67 | + Any content (Halstack components or custom) can be placed inside the dialog component. Dialog tasks should be |
| 68 | + direct and easy to complete. However, to ensure that the component is used as intended and to prevent it from |
| 69 | + becoming unusable, please consider the following aspects: |
| 70 | + </DxcParagraph> |
| 71 | + <DxcBulletedList> |
| 72 | + <DxcBulletedList.Item> |
| 73 | + <strong>Avoid placing complex or large amounts of data</strong>, as it will increase the cognitive load and |
| 74 | + users will struggle when processing information. |
| 75 | + </DxcBulletedList.Item> |
| 76 | + <DxcBulletedList.Item> |
| 77 | + As much as possible, <strong>avoid scrolling in a dialog</strong>, as it disrupts focus and usability, |
| 78 | + especially for modal interactions that require immediate attention. It can also make critical actions harder |
| 79 | + to access, forcing users to scroll to find the key information or buttons. Instead, keep dialogs concise or |
| 80 | + consider alternative patterns to display the information. |
| 81 | + </DxcBulletedList.Item> |
| 82 | + </DxcBulletedList> |
| 83 | + </> |
| 84 | + ), |
| 85 | + }, |
| 86 | + { |
| 87 | + title: "Overlay in dialogs", |
| 88 | + content: ( |
| 89 | + <> |
| 90 | + <DxcParagraph> |
| 91 | + The <strong>overlay</strong> element helps focus the user's attention on the dialog by creating a |
| 92 | + semi-transparent layer between the main application and the modal content. This visual separation reduces |
| 93 | + distractions, ensures the dialog stands out, and reinforces the need for user action before returning to the |
| 94 | + underlying interface. Additionally, it enhances accessibility by preventing unintended interactions with |
| 95 | + background elements. |
| 96 | + </DxcParagraph> |
| 97 | + <Figure caption="Example of the overlay usage in a dialog"> |
| 98 | + <Image src={overlay} alt="Example of the overlay usage in a dialog" /> |
| 99 | + </Figure> |
| 100 | + </> |
| 101 | + ), |
| 102 | + }, |
| 103 | + { |
| 104 | + title: "Best practices", |
| 105 | + content: ( |
| 106 | + <> |
| 107 | + <DxcBulletedList> |
| 108 | + <DxcBulletedList.Item> |
| 109 | + <strong>Use dialogs for critical interactions:</strong> reserve dialogs for important decisions that require |
| 110 | + user confirmation or input. |
| 111 | + </DxcBulletedList.Item> |
| 112 | + <DxcBulletedList.Item> |
| 113 | + <strong>Ensure clarity:</strong> titles and messages should be direct, with clear descriptions of the |
| 114 | + action's consequences. |
| 115 | + </DxcBulletedList.Item> |
| 116 | + <DxcBulletedList.Item> |
| 117 | + <strong>Provide easy dismissal:</strong> always include a way to close the dialog, whether through a cancel |
| 118 | + button or a close icon. |
| 119 | + </DxcBulletedList.Item> |
| 120 | + <DxcBulletedList.Item> |
| 121 | + <strong>Maintain focus:</strong> keep the user's attention within the dialog by managing focus and |
| 122 | + preventing background interactions. |
| 123 | + </DxcBulletedList.Item> |
| 124 | + <DxcBulletedList.Item> |
| 125 | + <strong>Provide clear actions:</strong> use distinct primary and secondary buttons for confirmation and |
| 126 | + cancellation. |
| 127 | + </DxcBulletedList.Item> |
| 128 | + <DxcBulletedList.Item> |
| 129 | + <strong>Keep it focused:</strong> dialogs should be concise and address a single task to avoid overwhelming |
| 130 | + users. |
| 131 | + </DxcBulletedList.Item> |
| 132 | + <DxcBulletedList.Item> |
| 133 | + <strong>Avoid scrolling:</strong> keep content brief to prevent excessive scrolling; use alternative |
| 134 | + patterns for complex interactions. |
| 135 | + </DxcBulletedList.Item> |
| 136 | + </DxcBulletedList> |
| 137 | + </> |
| 138 | + ), |
| 139 | + }, |
| 140 | +]; |
| 141 | + |
| 142 | +const DialogOverviewPage = () => ( |
| 143 | + <DxcFlex direction="column" gap="4rem"> |
| 144 | + <QuickNavContainerLayout> |
| 145 | + <QuickNavContainer sections={sections} startHeadingLevel={2} /> |
| 146 | + </QuickNavContainerLayout> |
| 147 | + <DocFooter githubLink="https://github.com/dxc-technology/halstack-react/blob/master/apps/website/screens/components/dialog/overview/DialogOverviewPage.tsx" /> |
| 148 | + </DxcFlex> |
| 149 | +); |
| 150 | + |
| 151 | +export default DialogOverviewPage; |
0 commit comments