@transferwise/components 46.114.1 → 46.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/closeButton/CloseButton.messages.js +2 -2
- package/build/common/closeButton/CloseButton.messages.js.map +1 -1
- package/build/common/closeButton/CloseButton.messages.mjs +2 -2
- package/build/common/closeButton/CloseButton.messages.mjs.map +1 -1
- package/build/common/closeButton/CloseButton.mjs +2 -2
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/drawer/Drawer.js +18 -9
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +18 -9
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/main.css +17 -127
- package/build/modal/Modal.js +20 -21
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +20 -21
- package/build/modal/Modal.mjs.map +1 -1
- package/build/styles/drawer/Drawer.css +11 -58
- package/build/styles/main.css +17 -127
- package/build/styles/modal/Modal.css +6 -69
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/avatarLayout/AvatarLayout.story.tsx +1 -0
- package/src/avatarView/AvatarView.story.tsx +1 -0
- package/src/display/Display.story.tsx +1 -0
- package/src/drawer/Drawer.css +11 -58
- package/src/drawer/Drawer.less +14 -70
- package/src/drawer/Drawer.story.tsx +158 -100
- package/src/drawer/Drawer.tsx +26 -7
- package/src/iconButton/IconButton.story.tsx +1 -0
- package/src/main.css +17 -127
- package/src/modal/Modal.css +6 -69
- package/src/modal/Modal.less +6 -76
- package/src/modal/Modal.tsx +23 -23
package/src/drawer/Drawer.css
CHANGED
|
@@ -16,88 +16,41 @@
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
.np-drawer .np-drawer-header {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
flex-wrap: nowrap;
|
|
22
19
|
min-height: 56px;
|
|
23
20
|
min-height: var(--size-56);
|
|
24
|
-
padding: 24px 16px;
|
|
25
|
-
padding: var(--size-24) var(--size-16);
|
|
26
|
-
}
|
|
27
|
-
.np-theme-personal .np-drawer .np-drawer-header {
|
|
28
21
|
padding: 24px;
|
|
29
22
|
padding: var(--size-24);
|
|
30
23
|
}
|
|
31
24
|
@media (max-width: 320px) {
|
|
32
|
-
.np-
|
|
25
|
+
.np-drawer .np-drawer-header {
|
|
33
26
|
padding: 16px;
|
|
34
27
|
padding: var(--size-16);
|
|
35
28
|
}
|
|
36
29
|
}
|
|
37
|
-
.np-
|
|
38
|
-
|
|
39
|
-
margin-top: calc(var(--size-8) * -1);
|
|
40
|
-
margin-right: calc(8px * -1);
|
|
41
|
-
margin-right: calc(var(--size-8) * -1);
|
|
42
|
-
margin-bottom: calc(8px * -1);
|
|
43
|
-
margin-bottom: calc(var(--size-8) * -1);
|
|
44
|
-
}
|
|
45
|
-
.np-drawer .np-drawer-header.np-drawer-header--withborder {
|
|
46
|
-
box-shadow: inset 0 -1px 0 0 #e2e6e8;
|
|
47
|
-
}
|
|
48
|
-
.np-theme-personal .np-drawer .np-drawer-header.np-drawer-header--withborder {
|
|
49
|
-
box-shadow: inset 0 -1px 0 0 rgba(0,0,0,0.10196);
|
|
50
|
-
box-shadow: inset 0 -1px 0 0 var(--color-border-neutral);
|
|
51
|
-
}
|
|
52
|
-
.np-drawer .np-drawer-header .np-text-title-body {
|
|
53
|
-
margin-right: 16px;
|
|
54
|
-
margin-right: var(--size-16);
|
|
55
|
-
font-size: 1.125rem;
|
|
56
|
-
font-size: var(--font-size-18);
|
|
57
|
-
letter-spacing: -0.01em;
|
|
58
|
-
letter-spacing: var(--letter-spacing-negative-xs);
|
|
59
|
-
line-height: 1.5rem;
|
|
60
|
-
line-height: var(--line-height-24);
|
|
61
|
-
}
|
|
62
|
-
.np-drawer .np-drawer-header .np-close-button {
|
|
63
|
-
margin-left: auto;
|
|
64
|
-
}
|
|
65
|
-
.np-drawer .np-drawer-header .tw-icon {
|
|
66
|
-
display: block;
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
fill: #00b9ff;
|
|
30
|
+
.np-drawer .np-drawer-title {
|
|
31
|
+
max-width: 85%;
|
|
69
32
|
}
|
|
70
33
|
.np-drawer .np-drawer-content {
|
|
71
34
|
overflow-y: auto;
|
|
72
35
|
flex: 1;
|
|
73
|
-
}
|
|
74
|
-
.np-drawer .np-drawer-content .np-theme-personal {
|
|
75
36
|
background-color: transparent;
|
|
76
37
|
}
|
|
77
|
-
.np-drawer .np-drawer-footer
|
|
78
|
-
.np-drawer .np-drawer-content {
|
|
38
|
+
.np-drawer .np-drawer-footer {
|
|
79
39
|
padding: 16px;
|
|
80
40
|
padding: var(--size-16);
|
|
81
41
|
}
|
|
82
|
-
.np-drawer .np-drawer-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.np-theme-personal .np-drawer .np-drawer-footer {
|
|
86
|
-
box-shadow: inset 0 1px 0 0 rgba(0,0,0,0.10196);
|
|
87
|
-
box-shadow: inset 0 1px 0 0 var(--color-border-neutral);
|
|
42
|
+
.np-drawer .np-drawer-content {
|
|
43
|
+
padding: 0 16px;
|
|
44
|
+
padding: 0 var(--size-16);
|
|
88
45
|
}
|
|
89
46
|
@media (min-width: 768px) {
|
|
90
|
-
.np-drawer .np-drawer-header
|
|
91
|
-
|
|
92
|
-
padding: var(--size-32) var(--size-24);
|
|
93
|
-
}
|
|
94
|
-
.np-theme-personal .np-drawer .np-drawer-header {
|
|
47
|
+
.np-drawer .np-drawer-header,
|
|
48
|
+
.np-drawer .np-drawer-footer {
|
|
95
49
|
padding: 24px;
|
|
96
50
|
padding: var(--size-24);
|
|
97
51
|
}
|
|
98
|
-
.np-drawer .np-drawer-footer,
|
|
99
52
|
.np-drawer .np-drawer-content {
|
|
100
|
-
padding: 24px;
|
|
101
|
-
padding: var(--size-24);
|
|
53
|
+
padding: 0 24px;
|
|
54
|
+
padding: 0 var(--size-24);
|
|
102
55
|
}
|
|
103
56
|
}
|
package/src/drawer/Drawer.less
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/addons/_spacing-utilities.less";
|
|
2
|
-
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/mixins/_logical-properties.less";
|
|
3
|
-
|
|
4
1
|
.np-drawer {
|
|
5
2
|
display: flex;
|
|
6
3
|
flex-direction: column;
|
|
@@ -16,89 +13,36 @@
|
|
|
16
13
|
max-height: 100dvh;
|
|
17
14
|
|
|
18
15
|
.np-drawer-header {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
flex-wrap: nowrap;
|
|
22
16
|
min-height: var(--size-56);
|
|
23
|
-
padding: var(--size-24)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
padding: var(--size-24);
|
|
27
|
-
@media (--screen-400-zoom) {
|
|
28
|
-
padding: var(--size-16);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.np-close-button {
|
|
32
|
-
@close-btn-margin: calc(var(--size-8) * -1);
|
|
33
|
-
|
|
34
|
-
margin-top: @close-btn-margin;
|
|
35
|
-
margin-right: @close-btn-margin;
|
|
36
|
-
margin-bottom: @close-btn-margin;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&.np-drawer-header--withborder {
|
|
41
|
-
box-shadow: inset 0 -1px 0 0 rgb(226 230 232);
|
|
42
|
-
|
|
43
|
-
.np-theme-personal & {
|
|
44
|
-
box-shadow: inset 0 -1px 0 0 var(--color-border-neutral);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.np-text-title-body {
|
|
49
|
-
margin-right: var(--size-16);
|
|
50
|
-
font-size: var(--font-size-18);
|
|
51
|
-
letter-spacing: var(--letter-spacing-negative-xs);
|
|
52
|
-
line-height: var(--line-height-24);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.np-close-button {
|
|
56
|
-
margin-left: auto;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.tw-icon {
|
|
60
|
-
display: block;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
fill: rgb(0 185 255);
|
|
17
|
+
padding: var(--size-24);
|
|
18
|
+
@media (--screen-400-zoom) {
|
|
19
|
+
padding: var(--size-16);
|
|
63
20
|
}
|
|
64
21
|
}
|
|
65
|
-
|
|
22
|
+
.np-drawer-title {
|
|
23
|
+
max-width: 85%;
|
|
24
|
+
}
|
|
66
25
|
.np-drawer-content {
|
|
67
26
|
overflow-y: auto;
|
|
68
27
|
flex: 1;
|
|
69
|
-
|
|
70
|
-
.np-theme-personal {
|
|
71
|
-
background-color: transparent;
|
|
72
|
-
}
|
|
28
|
+
background-color: transparent;
|
|
73
29
|
}
|
|
74
|
-
|
|
75
|
-
.np-drawer-footer,
|
|
76
|
-
.np-drawer-content {
|
|
30
|
+
.np-drawer-footer {
|
|
77
31
|
padding: var(--size-16);
|
|
78
32
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
box-shadow: inset 0 1px 0 0 rgb(226 230 232);
|
|
82
|
-
|
|
83
|
-
.np-theme-personal & {
|
|
84
|
-
box-shadow: inset 0 1px 0 0 var(--color-border-neutral);
|
|
85
|
-
}
|
|
33
|
+
.np-drawer-content {
|
|
34
|
+
padding: 0 var(--size-16);
|
|
86
35
|
}
|
|
87
36
|
}
|
|
88
37
|
|
|
89
38
|
@media (--screen-md) {
|
|
90
39
|
.np-drawer {
|
|
91
|
-
.np-drawer-header
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
.np-theme-personal & {
|
|
95
|
-
padding: var(--size-24);
|
|
96
|
-
}
|
|
40
|
+
.np-drawer-header,
|
|
41
|
+
.np-drawer-footer {
|
|
42
|
+
padding: var(--size-24);
|
|
97
43
|
}
|
|
98
|
-
|
|
99
|
-
.np-drawer-footer,
|
|
100
44
|
.np-drawer-content {
|
|
101
|
-
padding: var(--size-24);
|
|
45
|
+
padding: 0 var(--size-24);
|
|
102
46
|
}
|
|
103
47
|
}
|
|
104
48
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Position, Priority } from '../common';
|
|
3
|
-
import { Section, Button, Input, Modal, type DrawerProps } from '..';
|
|
3
|
+
import { Section, Button, Input, Modal, type DrawerProps, Body } from '..';
|
|
4
4
|
import Drawer from './Drawer';
|
|
5
|
+
import { lorem10, lorem20, lorem40, lorem5 } from '../test-utils';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
component: Drawer,
|
|
@@ -14,110 +15,167 @@ export default {
|
|
|
14
15
|
},
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
export const Basic =
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
export const Basic = {
|
|
19
|
+
args: {
|
|
20
|
+
position: Position.RIGHT,
|
|
21
|
+
open: true,
|
|
22
|
+
},
|
|
23
|
+
render: (args: DrawerProps) => {
|
|
24
|
+
const [openDrawer, setOpenDrawer] = useState(args.open);
|
|
25
|
+
const [openModal, setOpenModal] = useState(false);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<Button v2 disabled={false} block={false} onClick={() => setOpenDrawer(true)}>
|
|
30
|
+
Open drawer
|
|
31
|
+
</Button>
|
|
32
|
+
<Drawer
|
|
33
|
+
open={openDrawer}
|
|
34
|
+
position={args.position}
|
|
35
|
+
headerTitle="This is the title of the drawer"
|
|
36
|
+
footerContent={
|
|
37
|
+
<>
|
|
38
|
+
<Button v2 block className="m-b-1" onClick={() => {}}>
|
|
39
|
+
Action 1
|
|
40
|
+
</Button>
|
|
41
|
+
<Button v2 block priority={Priority.SECONDARY} onClick={() => {}}>
|
|
42
|
+
Action 2
|
|
43
|
+
</Button>
|
|
44
|
+
</>
|
|
45
|
+
}
|
|
46
|
+
onClose={(event) => {
|
|
47
|
+
console.log('drawer close');
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
setOpenDrawer(false);
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<p>{lorem20}</p>
|
|
53
|
+
<Section className="m-t-2">
|
|
54
|
+
<Input />
|
|
55
|
+
<p className="m-t-3">{lorem5}</p>
|
|
56
|
+
<Button v2 onClick={() => setOpenModal(true)}>
|
|
57
|
+
Open Modal
|
|
58
|
+
</Button>
|
|
59
|
+
<Modal
|
|
60
|
+
body={<p>{lorem40}</p>}
|
|
61
|
+
open={openModal}
|
|
62
|
+
title="Title"
|
|
63
|
+
onClose={() => {
|
|
64
|
+
console.log('modal close');
|
|
65
|
+
setOpenModal(false);
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
</Section>
|
|
69
|
+
<p>{lorem40}</p>
|
|
70
|
+
<p>{lorem40}</p>
|
|
71
|
+
<p>{lorem40}</p>
|
|
72
|
+
<p>{lorem40}</p>
|
|
73
|
+
<p>{lorem40}</p>
|
|
74
|
+
<p>{lorem40}</p>
|
|
75
|
+
</Drawer>
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
20
80
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
81
|
+
export const LongTitle = {
|
|
82
|
+
args: {
|
|
83
|
+
open: true,
|
|
84
|
+
},
|
|
85
|
+
render: (args: DrawerProps) => {
|
|
86
|
+
const [openDrawer, setOpenDrawer] = useState(args.open);
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<Button v2 block={false} onClick={() => setOpenDrawer(true)}>
|
|
90
|
+
Open drawer
|
|
91
|
+
</Button>
|
|
92
|
+
<Drawer
|
|
93
|
+
open={openDrawer}
|
|
94
|
+
headerTitle={lorem10}
|
|
95
|
+
footerContent={
|
|
32
96
|
<Button v2 block onClick={() => {}}>
|
|
33
97
|
Action 1
|
|
34
98
|
</Button>
|
|
35
|
-
|
|
36
|
-
|
|
99
|
+
}
|
|
100
|
+
onClose={() => {
|
|
101
|
+
setOpenDrawer(false);
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<p>{lorem20}</p>
|
|
105
|
+
<p>{lorem40}</p>
|
|
106
|
+
<p>{lorem40}</p>
|
|
107
|
+
<p>{lorem40}</p>
|
|
108
|
+
<p>{lorem40}</p>
|
|
109
|
+
<p>{lorem40}</p>
|
|
110
|
+
<p>{lorem40}</p>
|
|
111
|
+
</Drawer>
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const NoTitle = {
|
|
118
|
+
args: {
|
|
119
|
+
open: true,
|
|
120
|
+
},
|
|
121
|
+
render: (args: DrawerProps) => {
|
|
122
|
+
const [openDrawer, setOpenDrawer] = useState(args.open);
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<Button v2 block={false} onClick={() => setOpenDrawer(true)}>
|
|
126
|
+
Open drawer
|
|
127
|
+
</Button>
|
|
128
|
+
<Drawer
|
|
129
|
+
open={openDrawer}
|
|
130
|
+
footerContent={
|
|
131
|
+
<Button v2 block onClick={() => {}}>
|
|
132
|
+
Action 1
|
|
37
133
|
</Button>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<p className="m-t-3">Cat ipsum dolor sit amet, purr when being pet.</p>
|
|
55
|
-
<Button v2 onClick={() => setOpenModal(true)}>
|
|
56
|
-
Open Modal
|
|
57
|
-
</Button>
|
|
58
|
-
<Modal
|
|
59
|
-
body={
|
|
60
|
-
<p className="m-t-4">
|
|
61
|
-
I am baby actually poke kickstarter, street art jean shorts bespoke chambray
|
|
62
|
-
activated charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo,
|
|
63
|
-
cliche lyft marfa ethical waistcoat poke jean shorts. Scenester readymade selvage
|
|
64
|
-
disrupt pok pok. La croix stumptown try-hard chartreuse. I am baby actually poke
|
|
65
|
-
kickstarter, street art jean shorts bespoke chambray activated charcoal ramps marfa
|
|
66
|
-
shoreditch tumeric, I am baby actually poke kickstarter, street art jean shorts
|
|
67
|
-
bespoke chambray activated charcoal ramps marfa shoreditch tumeric tumblr. Mixtape
|
|
68
|
-
cred palo santo, cliche lyft marfa ethical waistcoat poke jean shorts. Scenester
|
|
69
|
-
readymade selvage disrupt pok pok.
|
|
70
|
-
</p>
|
|
71
|
-
}
|
|
72
|
-
open={openModal}
|
|
73
|
-
title="Title"
|
|
74
|
-
onClose={() => {
|
|
75
|
-
console.log('modal close');
|
|
76
|
-
setOpenModal(false);
|
|
77
|
-
}}
|
|
78
|
-
/>
|
|
79
|
-
</Section>
|
|
80
|
-
<p>
|
|
81
|
-
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
82
|
-
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
83
|
-
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
84
|
-
stumptown try-hard chartreuse.
|
|
85
|
-
</p>
|
|
86
|
-
<p>
|
|
87
|
-
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
88
|
-
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
89
|
-
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
90
|
-
stumptown try-hard chartreuse.
|
|
91
|
-
</p>
|
|
92
|
-
<p>
|
|
93
|
-
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
94
|
-
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
95
|
-
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
96
|
-
stumptown try-hard chartreuse.
|
|
97
|
-
</p>
|
|
98
|
-
<p>
|
|
99
|
-
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
100
|
-
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
101
|
-
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
102
|
-
stumptown try-hard chartreuse.
|
|
103
|
-
</p>
|
|
104
|
-
<p>
|
|
105
|
-
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
106
|
-
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
107
|
-
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
108
|
-
stumptown try-hard chartreuse.
|
|
109
|
-
</p>
|
|
110
|
-
<p>
|
|
111
|
-
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
112
|
-
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
113
|
-
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
114
|
-
stumptown try-hard chartreuse.
|
|
115
|
-
</p>
|
|
116
|
-
</Drawer>
|
|
117
|
-
</>
|
|
118
|
-
);
|
|
134
|
+
}
|
|
135
|
+
onClose={() => {
|
|
136
|
+
setOpenDrawer(false);
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
<p>{lorem20}</p>
|
|
140
|
+
<p>{lorem40}</p>
|
|
141
|
+
<p>{lorem40}</p>
|
|
142
|
+
<p>{lorem40}</p>
|
|
143
|
+
<p>{lorem40}</p>
|
|
144
|
+
<p>{lorem40}</p>
|
|
145
|
+
<p>{lorem40}</p>
|
|
146
|
+
</Drawer>
|
|
147
|
+
</>
|
|
148
|
+
);
|
|
149
|
+
},
|
|
119
150
|
};
|
|
120
151
|
|
|
121
|
-
|
|
122
|
-
|
|
152
|
+
export const NoFooter = {
|
|
153
|
+
args: {
|
|
154
|
+
open: true,
|
|
155
|
+
},
|
|
156
|
+
render: (args: DrawerProps) => {
|
|
157
|
+
const [openDrawer, setOpenDrawer] = useState(args.open);
|
|
158
|
+
return (
|
|
159
|
+
<>
|
|
160
|
+
<Button v2 block={false} onClick={() => setOpenDrawer(true)}>
|
|
161
|
+
Open drawer
|
|
162
|
+
</Button>
|
|
163
|
+
<Drawer
|
|
164
|
+
open={openDrawer}
|
|
165
|
+
headerTitle="This is the title of the drawer"
|
|
166
|
+
onClose={() => {
|
|
167
|
+
setOpenDrawer(false);
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
<p>{lorem20}</p>
|
|
171
|
+
<p>{lorem40}</p>
|
|
172
|
+
<p>{lorem40}</p>
|
|
173
|
+
<p>{lorem40}</p>
|
|
174
|
+
<p>{lorem40}</p>
|
|
175
|
+
<p>{lorem40}</p>
|
|
176
|
+
<Body>{lorem40}</Body>
|
|
177
|
+
</Drawer>
|
|
178
|
+
</>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
123
181
|
};
|
package/src/drawer/Drawer.tsx
CHANGED
|
@@ -2,13 +2,16 @@ import { clsx } from 'clsx';
|
|
|
2
2
|
import { HTMLAttributes, useContext, useId } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Position, Typography } from '../common';
|
|
5
|
-
import { CloseButton } from '../common/closeButton';
|
|
6
5
|
import { useLayout } from '../common/hooks';
|
|
7
6
|
import Dimmer from '../dimmer';
|
|
8
7
|
import { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';
|
|
9
8
|
import SlidingPanel from '../slidingPanel';
|
|
10
9
|
import Title from '../title';
|
|
11
10
|
import { logActionRequiredIf } from '../utilities';
|
|
11
|
+
import IconButton from '../iconButton';
|
|
12
|
+
import closeBtnMessages from '../common/closeButton/CloseButton.messages';
|
|
13
|
+
import { useIntl } from 'react-intl';
|
|
14
|
+
import { Cross } from '@transferwise/icons';
|
|
12
15
|
|
|
13
16
|
export type DrawerProps = {
|
|
14
17
|
/** The content to appear in the drawer body. */
|
|
@@ -39,6 +42,7 @@ export default function Drawer({
|
|
|
39
42
|
role = 'dialog',
|
|
40
43
|
'aria-labelledby': ariaLabelledBy,
|
|
41
44
|
}: DrawerProps) {
|
|
45
|
+
const intl = useIntl();
|
|
42
46
|
logActionRequiredIf(
|
|
43
47
|
'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',
|
|
44
48
|
!onClose,
|
|
@@ -60,19 +64,34 @@ export default function Drawer({
|
|
|
60
64
|
className={clsx('np-drawer', className)}
|
|
61
65
|
>
|
|
62
66
|
<div
|
|
63
|
-
className={clsx(
|
|
64
|
-
'np-drawer-header
|
|
65
|
-
|
|
67
|
+
className={clsx(
|
|
68
|
+
'np-drawer-header',
|
|
69
|
+
'd-flex',
|
|
70
|
+
'align-items-center',
|
|
71
|
+
headerTitle ? 'justify-content-between' : 'justify-content-end',
|
|
72
|
+
'flex-wrap',
|
|
73
|
+
)}
|
|
66
74
|
>
|
|
67
75
|
{headerTitle && (
|
|
68
|
-
<Title id={titleId} type={Typography.
|
|
76
|
+
<Title id={titleId} type={Typography.TITLE_SUBSECTION} className="np-drawer-title">
|
|
69
77
|
{headerTitle}
|
|
70
78
|
</Title>
|
|
71
79
|
)}
|
|
72
|
-
<
|
|
80
|
+
<IconButton
|
|
81
|
+
size={40}
|
|
82
|
+
priority="tertiary"
|
|
83
|
+
aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}
|
|
84
|
+
onClick={onClose}
|
|
85
|
+
>
|
|
86
|
+
<Cross />
|
|
87
|
+
</IconButton>
|
|
73
88
|
</div>
|
|
74
89
|
{children && <div className={clsx('np-drawer-content')}>{children}</div>}
|
|
75
|
-
{footerContent
|
|
90
|
+
{footerContent ? (
|
|
91
|
+
<div className={clsx('np-drawer-footer')}>{footerContent}</div>
|
|
92
|
+
) : (
|
|
93
|
+
<div className="m-t-3" />
|
|
94
|
+
)}
|
|
76
95
|
</div>
|
|
77
96
|
</SlidingPanel>
|
|
78
97
|
</Dimmer>
|