diff --git a/apps/website/pages/patterns/error.tsx b/apps/website/pages/patterns/error.tsx new file mode 100644 index 000000000..818397540 --- /dev/null +++ b/apps/website/pages/patterns/error.tsx @@ -0,0 +1,13 @@ +import Head from "next/head"; +import ErrorPatternPage from "screens/patterns/error/ErrorPatternPage"; + +const Index = () => ( + <> + + Error pattern — Halstack Design System + + + +); + +export default Index; diff --git a/apps/website/pages/patterns/login.tsx b/apps/website/pages/patterns/login.tsx new file mode 100644 index 000000000..8b53b1782 --- /dev/null +++ b/apps/website/pages/patterns/login.tsx @@ -0,0 +1,13 @@ +import Head from "next/head"; +import LoginPatternPage from "screens/patterns/login/LoginPatternPage"; + +const Index = () => ( + <> + + Login pattern — Halstack Design System + + + +); + +export default Index; diff --git a/apps/website/pages/patterns/modals.tsx b/apps/website/pages/patterns/modals.tsx new file mode 100644 index 000000000..85af2f9fa --- /dev/null +++ b/apps/website/pages/patterns/modals.tsx @@ -0,0 +1,13 @@ +import Head from "next/head"; +import ModalsPatternPage from "screens/patterns/modals/ModalsPatternPage"; + +const Index = () => ( + <> + + Modals pattern — Halstack Design System + + + +); + +export default Index; diff --git a/apps/website/screens/common/pagesList.tsx b/apps/website/screens/common/pagesList.tsx index 8a5341d47..6880bd998 100644 --- a/apps/website/screens/common/pagesList.tsx +++ b/apps/website/screens/common/pagesList.tsx @@ -67,6 +67,12 @@ const v16Links: LinkDetails[] = [ const migrationLinks: LinksSectionDetails[] = [{ label: "v16", links: v16Links, icon: "deployed_code_update" }]; +const patternsLinks: LinkDetails[] = [ + { label: "Error", path: "/patterns/error", icon: "error" }, + { label: "Login", path: "/patterns/login", icon: "login" }, + { label: "Modals", path: "/patterns/modals", icon: "feedback" }, +]; + const componentsLinks = componentsList as (LinkDetails | LinksSectionDetails)[]; export const LinksSections: LinksSectionDetails[] = [ @@ -75,6 +81,7 @@ export const LinksSections: LinksSectionDetails[] = [ { label: "Foundations", links: foundationsLinks }, { label: "Migration", links: migrationLinks }, { label: "Utilities", links: utilitiesLinks }, + { label: "Patterns", links: patternsLinks }, { label: "Components", links: componentsLinks }, ]; diff --git a/apps/website/screens/patterns/error/ErrorPatternPage.tsx b/apps/website/screens/patterns/error/ErrorPatternPage.tsx new file mode 100644 index 000000000..e23e60f58 --- /dev/null +++ b/apps/website/screens/patterns/error/ErrorPatternPage.tsx @@ -0,0 +1,455 @@ +import { DxcFlex, DxcParagraph, DxcBulletedList, DxcTable, DxcHeading } from "@dxc-technology/halstack-react"; +import QuickNavContainer from "@/common/QuickNavContainer"; +import DocFooter from "@/common/DocFooter"; +import Image from "@/common/Image"; +import errorAnatomy from "./images/error_anatomy.png"; +import errorExample from "./images/error_example.png"; +import PageHeading from "@/common/PageHeading"; + +const sections = [ + { + title: "Overview", + content: ( + <> + + The error message pattern provides a consistent way to communicate when users encounter an issue, cannot + access a resource, or when a requested action cannot be completed. + + + It uses clear messaging, visual indicators, and appropriate actions to help users understand what happened and + determine what to do next. + + + The pattern supports different error and empty-state scenarios while maintaining a consistent layout and user + experience across Halstack products. It can use either an icon or an illustration depending on the context and + severity of the situation. + + + ), + }, + { + title: "Anatomy", + content: ( + <> + Error page anatomy + + + Back link (Optional): Allows users to navigate back to the previous page or location. It is + positioned at the top of the content area and uses the Button Link component. + + + Icon / Illustration: Provides a visual representation of the current error or status. It + can use a simple icon or a more descriptive illustration. + + + Tile: Clearly communicates the issue or current state using a short and descriptive + heading. + + + Subtitle (Optional): Provides additional context about what happened, why the issue + occurred, or what the user can expect. + + + Primary button: Offers the main action users can take to resolve the issue or continue + their journey. + + + Container: Serves as the main wrapper that groups and organizes all elements of the error + message pattern. It maintains the overall layout, spacing, and alignment within the available page area. + + + Secondary button (Optional): Provides an alternative action when another option is + available. + + + + ), + }, + { + title: "When to use", + content: ( + <> + Use the error message pattern when: + + A requested page or resource cannot be found. + Users do not have permission to access a particular resource. + + An unexpected system error prevents an action from being completed. + + A service is temporarily unavailable or undergoing maintenance. + + Users need clear guidance on how to recover from an unsuccessful action. + + + A page needs to communicate an empty state caused by an error or unavailable resource. + + + + ), + }, + { + title: "When not to use", + content: ( + <> + Do not use the error message pattern when: + + + A simple inline validation message is sufficient to explain an issue with a specific form field. + + + A small notification or toast is enough to communicate the result of an action. + + + The page is intentionally empty and does not require an error or recovery message. + + + A loading indicator is more appropriate because the system is still processing a request. + + + + ), + }, + { + title: "Best practices", + content: ( + <> + + Explain what happened using straightforward language. + + + Include enough information to help users understand the issue without overwhelming them. + + + Provide a relevant primary action whenever possible. + + + Button labels should describe the expected outcome, such as "Try again", "Take me Home", or "Request access". + + + + Choose an icon for simple or straightforward messages and an illustration when additional visual context is + helpful. + + + + Keep the layout, spacing, alignment, and hierarchy consistent across different error scenarios. + + + + Do not expose internal system details or error codes unless they are useful to the user. + + + ), + }, + { + title: "Designing with error message", + subSections: [ + { + title: "Layout and placement", + content: ( + <> + + + Container: Use a container to group and organize the error message elements within the + available page area. + + + Content alignment: Center the main error content within the container. + + + Visual placement: Position the icon or illustration above the title to establish the + visual hierarchy. + + + Text hierarchy: Place the title below the visual, followed by a subtitle that provides + additional context. + + + Action placement: Position the primary and secondary buttons below the subtitle. + + + Back navigation: Position the button link at the top-left of the container to allow + users to return to the previous page or location. + + + Spacing: Maintain consistent spacing between the visual, title, subtitle, and action + buttons. + + + Error example + + The content should remain visually balanced and easy to scan, regardless of whether an icon or + illustration is used. + + + ), + }, + { + title: "Behavior", + subSections: [ + { + title: "Primary and secondary actions", + content: ( + + + Primary button: Triggers the main action associated with the error, such as retrying + and request access. + + + Secondary button: When available, provides an alternative action to help users to + report issue or return to home. + + + ), + }, + { + title: "Back navigation", + content: ( + + + Button link: When selected, navigates users to the previous page or location, + following the application's navigation behavior. + + + ), + }, + ], + }, + { + title: "Variants", + content: ( + <> + + The error message pattern supports four scenarios, each available in two visual treatments: Icon and + Illustration. + + + + Permission error (403): Communicates that the user does not have the required + permission to access a resource. + + + Server error (500): Indicates that something went wrong on the system's end and the + request could not be completed. + + + Maintenance (503): Informs users that a service or application is temporarily + unavailable due to maintenance or improvements. + + + Not found (404): Communicates that the requested page or resource cannot be found or + may have been removed. + + + + ), + }, + { + title: "Content", + content: ( + <> + + The content of the error message pattern should be clear, concise, and informative. Each element should + communicate the issue and guide users toward the appropriate next action. + + + + + Element + Content + + + + + Back button + Back to where the user was before + + + Title + Something went wrong on our end + + + Subtitle + + We couldn't load the module. The error has been logged; you can retry in a few seconds or + report the problem. + + + + Primary button + Retry + + + Secondary button + Report issue + + + + + ), + }, + { + title: "Using component", + content: ( + <> + + The error message pattern combines existing Halstack components to create a consistent error and + empty-state. + + + + + Element + Component + + + + + Container + Container + + + Icon + Avatar + + + Illustration + Custom illustration + + + Title + Heading + + + Subtitle + Heading + + + Primary action + Button (Primary) + + + Secondary action + Button (Secondary) + + + Back button + Button link (Tertiary) + + + + + Use the appropriate component variants to maintain consistency with the Halstack Design System. + + + ), + }, + ], + }, + { + title: "Accessibility", + content: ( + + The error message pattern should ensure that users can understand the error message and navigate through the + available actions regardless of their abilities. + + ), + subSections: [ + { + title: "Focus", + content: ( + <> + + The focus behavior and visible focus indicators are already handled by the corresponding Halstack + components. + + + When an error page replaces existing content, consider moving focus to the error heading so users are + immediately informed of the change. + + + ), + }, + { + title: "Keyboard navigation", + content: ( + + Keyboard accessibility and standard keyboard interactions are supported by the corresponding Halstack + components. + + ), + }, + { + title: "Tab order", + content: ( + <> + The recommended tab order is: + + Back button link (when available). + Primary button + Secondary button (when available). + + + Non-interactive elements, such as decorative icons and illustrations, should not be included in the tab + order. + + + ), + }, + ], + }, + { + title: "Related components", + content: ( + + + Container + + + Icon + + + Text + + + Button + + + Link + + + ), + }, + { + title: "Example", + content: ( +