diff --git a/src/Layout/Sidebar.story.tsx b/src/Layout/Sidebar.story.tsx
index a2fb6d5d6..fa8e88faf 100644
--- a/src/Layout/Sidebar.story.tsx
+++ b/src/Layout/Sidebar.story.tsx
@@ -11,6 +11,11 @@ import {
Select,
PrimaryButton,
Box,
+ Textarea,
+ Text,
+ Flex,
+ Button,
+ Heading3,
} from "..";
const primaryMenu = [
@@ -439,3 +444,61 @@ export const WithDifferentWidths = () => {
);
};
+
+export const WithHelpText = () => {
+ const [helpText, setHelpText] = useState(
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus tempor lacus nec finibus egestas."
+ );
+
+ return (
+
+
+ );
+};
+export const WithOtherElementsInHelpText = () => {
+ return (
+
+ Carry over remaining quantity to a future PO line item.{" "}
+
+ Learn more
+ {" "}
+ >
+ }
+ >
+ );
+};
+
+export const WithARenderedHelpText = () => {
+ return (
+ (
+
+ This is a custom help text{" "}
+
+ Learn more
+
+
+ )}
+ >
+ );
+};
diff --git a/src/Layout/Sidebar.tsx b/src/Layout/Sidebar.tsx
index 1b778e255..e0de15e69 100644
--- a/src/Layout/Sidebar.tsx
+++ b/src/Layout/Sidebar.tsx
@@ -4,10 +4,11 @@ import { useTranslation } from "react-i18next";
import { Box } from "../Box";
import { Flex } from "../Flex";
import { IconicButton } from "../Button";
-import { Heading3 } from "../Type";
+import { Heading3, Text } from "../Type";
import { AnimatedBoxProps, AnimatedBox } from "../Box/Box";
import { NAVBAR_HEIGHT } from "../BrandedNavBar/NavBar";
import { PreventBodyElementScrolling } from "../utils";
+import { Divider } from "../Divider";
type PredefinedSidebarWidth = "xs" | "s" | "m" | "l" | "xl";
@@ -41,6 +42,8 @@ type SidebarProps = Omit & {
disableScroll?: boolean;
hideCloseButton?: boolean;
width?: SidebarWidth;
+ helpText?: React.ReactNode;
+ renderHelpText?: () => React.ReactNode;
};
const focusFirstElement = () => {
@@ -69,7 +72,7 @@ const SidebarOverlay = ({ transitionDuration, top, transparent, zIndex = 799 as
/>
);
function Sidebar({
- p = "x3",
+ p = "x2",
width = "xs",
children,
onClose,
@@ -87,6 +90,8 @@ function Sidebar({
disableScroll = true,
hideCloseButton = false,
zIndex = "sidebar" as any,
+ helpText,
+ renderHelpText,
...props
}: SidebarProps) {
const closeButton = useRef(null);
@@ -191,24 +196,36 @@ function Sidebar({
flexDirection="column"
style={{ overflowBehaviour: "contain" } as any}
>
-
- {title && (
-
- {title}
+
+
+
+ {title && (
+
+ {title}
+
+ )}
+ {!hideCloseButton && (
+
+
+
+ )}
- )}
- {!hideCloseButton && (
-
-
-
- )}
+ {renderHelpText
+ ? renderHelpText()
+ : helpText && (
+
+ {helpText}
+
+ )}
+
+