File tree Expand file tree Collapse file tree 4 files changed +61
-9
lines changed Expand file tree Collapse file tree 4 files changed +61
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @nordcloud/gnui" ,
3
3
"description" : " Nordcloud Design System - a collection of reusable React components used in Nordcloud's SaaS products" ,
4
- "version" : " 10.4.3 " ,
4
+ "version" : " 10.4.4 " ,
5
5
"license" : " MIT" ,
6
6
"repository" : {
7
7
"type" : " git" ,
Original file line number Diff line number Diff line change @@ -249,3 +249,36 @@ export const CustomWidth: StoryObj = {
249
249
} ,
250
250
} ,
251
251
} ;
252
+
253
+ export const Expandable : StoryObj = {
254
+ render : ( ) => {
255
+ const { isOpen, open, close } = useDisclosure ( ) ;
256
+
257
+ return (
258
+ < Container >
259
+ < Row justify = "center" >
260
+ < Button onClick = { open } > Click button to open sidebar</ Button >
261
+ </ Row >
262
+ < Sidebar
263
+ showExpandButton
264
+ title = "Default sidebar"
265
+ caption = "Default sidebar caption"
266
+ isOpen = { isOpen }
267
+ onClick = { close }
268
+ onExpandClick = { ( ) => alert ( "clicked" ) }
269
+ >
270
+ Sidebar Content
271
+ </ Sidebar >
272
+ </ Container >
273
+ ) ;
274
+ } ,
275
+
276
+ name : "expandable" ,
277
+ parameters : {
278
+ docs : {
279
+ story : {
280
+ height : "450px" ,
281
+ } ,
282
+ } ,
283
+ } ,
284
+ } ;
Original file line number Diff line number Diff line change 1
1
import * as React from "react" ;
2
+ import { When } from "react-if" ;
2
3
import { Button } from "../button" ;
4
+ import { FlexContainer } from "../container" ;
3
5
import { Background } from "../modal/styles" ;
4
6
import { SVGIcon } from "../svgicon" ;
5
7
import {
@@ -34,6 +36,8 @@ export function Sidebar({
34
36
headerStyles,
35
37
contentStyles,
36
38
onClick = ( ) => undefined ,
39
+ showExpandButton = false ,
40
+ onExpandClick = ( ) => undefined ,
37
41
...props
38
42
} : SidebarProps ) {
39
43
React . useEffect ( ( ) => {
@@ -69,14 +73,27 @@ export function Sidebar({
69
73
</ Title >
70
74
{ caption && < Caption > { caption } </ Caption > }
71
75
</ header >
72
- < Button
73
- severity = "low"
74
- size = "md"
75
- icon = "close"
76
- title = "Close sidebar"
77
- type = "button"
78
- onClick = { onClick }
79
- />
76
+ < FlexContainer justifyContent = "space-evenly" >
77
+ < When condition = { showExpandButton } >
78
+ < Button
79
+ severity = "low"
80
+ size = "md"
81
+ icon = "externalLink"
82
+ title = "Expand"
83
+ type = "button"
84
+ marginRight = { 1 }
85
+ onClick = { onExpandClick }
86
+ />
87
+ </ When >
88
+ < Button
89
+ severity = "low"
90
+ size = "md"
91
+ icon = "close"
92
+ title = "Close sidebar"
93
+ type = "button"
94
+ onClick = { onClick }
95
+ />
96
+ </ FlexContainer >
80
97
</ Header >
81
98
< Container style = { contentStyles } >
82
99
< Content tag = "div" > { children } </ Content >
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ export type SidebarProps = {
10
10
width ?: number | string ;
11
11
reverse ?: boolean ;
12
12
onClick ?: ( ) => void ;
13
+ showExpandButton ?: boolean ;
14
+ onExpandClick ?: ( ) => void ;
13
15
footer ?: React . ReactNode ;
14
16
headerStyles ?: React . CSSProperties ;
15
17
contentStyles ?: React . CSSProperties ;
You can’t perform that action at this time.
0 commit comments