Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Commit d15a205

Browse files
authored
Merge pull request #374 from cjdev/fix-dialog-layout-content
DialogLayout now uses TopNav content
2 parents 399cf28 + c142938 commit d15a205

3 files changed

Lines changed: 20 additions & 41 deletions

File tree

packages/visual-stack/src/layouts/DialogLayout/index.css

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,6 @@
5454
fill: #fff;
5555
}
5656

57-
.vs-dialog-layout-content {
58-
position: relative;
59-
margin: 0 auto;
60-
z-index: 10;
61-
}
62-
63-
.vs-dialog-layout-content p {
64-
max-width: 580px;
65-
}
66-
67-
.vs-dialog-layout-content-normal {
68-
max-width: 800px;
69-
padding: 48px 24px 24px;
70-
}
71-
72-
.vs-dialog-layout-content-wide {
73-
max-width: 100%;
74-
padding: 48px 48px 48px;
75-
}
76-
7757
.vs-dialog-layout-button-bar .vs-text-btn {
7858
color: #fff;
7959
opacity: 0.64;

packages/visual-stack/src/layouts/DialogLayout/index.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,20 @@ export const DialogLayout = ({
3434
<div className={cn(`vs-dialog-layout`, className)} {...restProps}>
3535
<TopNav
3636
title={title}
37-
actionChildren=<TopNavControls
38-
onSubmit={onSubmit}
39-
onCancel={onCancel}
40-
submitButtonText={submitButtonText}
41-
cancelButtonText={cancelButtonText}
42-
disableSubmit={disableSubmit}
43-
showSubmitButtonSpinner={showSubmitButtonSpinner}
44-
/>
45-
/>
46-
<div
47-
className={cn(
48-
'vs-dialog-layout-content',
49-
`vs-dialog-layout-content-${contentSize ? contentSize : 'normal'}`
50-
)}
37+
contentSize={contentSize}
38+
actionChildren={
39+
<TopNavControls
40+
onSubmit={onSubmit}
41+
onCancel={onCancel}
42+
submitButtonText={submitButtonText}
43+
cancelButtonText={cancelButtonText}
44+
disableSubmit={disableSubmit}
45+
showSubmitButtonSpinner={showSubmitButtonSpinner}
46+
/>
47+
}
5148
>
5249
{children}
53-
</div>
50+
</TopNav>
5451
</div>
5552
);
5653

packages/visual-stack/src/layouts/DialogLayout/tests/index.test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import Adapter from 'enzyme-adapter-react-16';
55

66
Enzyme.configure({ adapter: new Adapter() });
77

8+
jest.mock('../../../components/CJLogo', () => () => <></>);
9+
810
describe('DialogLayout', () => {
911
test('should render', () => {
1012
const component = mount(
@@ -151,24 +153,24 @@ describe('DialogLayout', () => {
151153
test('should have wide content when contentSize is wide', () => {
152154
const component = mount(<DialogLayout contentSize={'wide'} />);
153155

154-
const content = component.find('.vs-dialog-layout-content');
156+
const content = component.find('.vs-topnav-content');
155157

156-
expect(content.hasClass('vs-dialog-layout-content-wide')).toBe(true);
158+
expect(content.hasClass('vs-topnav-content-wide')).toBe(true);
157159
});
158160

159161
test('should have normal content when contentSize is normal', () => {
160162
const component = mount(<DialogLayout contentSize={'normal'} />);
161163

162-
const content = component.find('.vs-dialog-layout-content');
164+
const content = component.find('.vs-topnav-content');
163165

164-
expect(content.hasClass('vs-dialog-layout-content-normal')).toBe(true);
166+
expect(content.hasClass('vs-topnav-content-normal')).toBe(true);
165167
});
166168

167169
test('should have normal content when contentSize is not passed', () => {
168170
const component = mount(<DialogLayout />);
169171

170-
const content = component.find('.vs-dialog-layout-content');
172+
const content = component.find('.vs-topnav-content');
171173

172-
expect(content.hasClass('vs-dialog-layout-content-normal')).toBe(true);
174+
expect(content.hasClass('vs-topnav-content-normal')).toBe(true);
173175
});
174176
});

0 commit comments

Comments
 (0)