@@ -4,10 +4,11 @@ import { useTranslation } from "react-i18next";
4
4
import { Box } from "../Box" ;
5
5
import { Flex } from "../Flex" ;
6
6
import { IconicButton } from "../Button" ;
7
- import { Heading3 } from "../Type" ;
7
+ import { Heading3 , Text } from "../Type" ;
8
8
import { AnimatedBoxProps , AnimatedBox } from "../Box/Box" ;
9
9
import { NAVBAR_HEIGHT } from "../BrandedNavBar/NavBar" ;
10
10
import { PreventBodyElementScrolling } from "../utils" ;
11
+ import { Divider } from "../Divider" ;
11
12
12
13
type PredefinedSidebarWidth = "xs" | "s" | "m" | "l" | "xl" ;
13
14
@@ -41,6 +42,8 @@ type SidebarProps = Omit<AnimatedBoxProps, "width"> & {
41
42
disableScroll ?: boolean ;
42
43
hideCloseButton ?: boolean ;
43
44
width ?: SidebarWidth ;
45
+ helpText ?: React . ReactNode ;
46
+ renderHelpText ?: ( ) => React . ReactNode ;
44
47
} ;
45
48
46
49
const focusFirstElement = ( ) => {
@@ -69,7 +72,7 @@ const SidebarOverlay = ({ transitionDuration, top, transparent, zIndex = 799 as
69
72
/>
70
73
) ;
71
74
function Sidebar ( {
72
- p = "x3 " ,
75
+ p = "x2 " ,
73
76
width = "xs" ,
74
77
children,
75
78
onClose,
@@ -87,6 +90,8 @@ function Sidebar({
87
90
disableScroll = true ,
88
91
hideCloseButton = false ,
89
92
zIndex = "sidebar" as any ,
93
+ helpText,
94
+ renderHelpText,
90
95
...props
91
96
} : SidebarProps ) {
92
97
const closeButton = useRef ( null ) ;
@@ -191,24 +196,36 @@ function Sidebar({
191
196
flexDirection = "column"
192
197
style = { { overflowBehaviour : "contain" } as any }
193
198
>
194
- < Flex justifyContent = "space-between" alignItems = "flex-start" pb = "x3" >
195
- { title && (
196
- < Flex alignItems = "center" height = "100%" >
197
- < Heading3 mb = { 0 } > { title } </ Heading3 >
199
+ < Flex flexDirection = "column" pb = "x3" >
200
+ < Flex flexDirection = "column" pb = "x2" >
201
+ < Flex justifyContent = "space-between" alignItems = "flex-start" >
202
+ { title && (
203
+ < Flex alignItems = "center" height = "100%" >
204
+ < Heading3 mb = { 0 } > { title } </ Heading3 >
205
+ </ Flex >
206
+ ) }
207
+ { ! hideCloseButton && (
208
+ < Box marginLeft = "x2" >
209
+ < IconicButton
210
+ type = "button"
211
+ ref = { closeButton }
212
+ icon = "close"
213
+ onClick = { onClose }
214
+ data-testid = { closeButtonTestId }
215
+ aria-label = { closeButtonAriaLabel || t ( "close" ) }
216
+ />
217
+ </ Box >
218
+ ) }
198
219
</ Flex >
199
- ) }
200
- { ! hideCloseButton && (
201
- < Box marginLeft = "x2" >
202
- < IconicButton
203
- type = "button"
204
- ref = { closeButton }
205
- icon = "close"
206
- onClick = { onClose }
207
- data-testid = { closeButtonTestId }
208
- aria-label = { closeButtonAriaLabel || t ( "close" ) }
209
- />
210
- </ Box >
211
- ) }
220
+ { renderHelpText
221
+ ? renderHelpText ( )
222
+ : helpText && (
223
+ < Text pt = "x1" color = "midGrey" >
224
+ { helpText }
225
+ </ Text >
226
+ ) }
227
+ </ Flex >
228
+ < Divider m = "0 -8px" width = "calc(100% + 16px)" />
212
229
</ Flex >
213
230
< AnimatedBox
214
231
variants = { childVariants }
0 commit comments