Skip to content

Commit 5bbb288

Browse files
committed
modal progress
1 parent a835e8e commit 5bbb288

File tree

2 files changed

+38
-43
lines changed

2 files changed

+38
-43
lines changed

components/SLDSModal/index.jsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1010
'use strict';
1111

1212
import React from 'react';
13-
import SLDSButton from './SLDSButton';
14-
import {Icon} from './SLDSIcons';
15-
import {EventUtil} from './utils';
16-
import SLDSDateInput from './SLDSDateInput';
13+
import SLDSButton from '../SLDSButton';
14+
import {Icon} from '../SLDSIcons';
15+
import {EventUtil} from '../utils';
16+
import SLDSDateInput from '../SLDSDateInput';
1717

1818

1919
import Modal from 'react-modal';
@@ -43,7 +43,10 @@ const customStyles = {
4343
module.exports = React.createClass( {
4444

4545
getDefaultProps () {
46-
return {isOpen:false};
46+
return {
47+
title:'',
48+
isOpen:false
49+
};
4750
},
4851

4952
getInitialState () {
@@ -75,15 +78,23 @@ module.exports = React.createClass( {
7578
onClick={this.closeModal}>
7679
<div className='slds-modal__container' onClick={(e)=>{EventUtil.trap(e);}}>
7780
<div className='slds-modal__header'>
78-
<h2 className='slds-text-heading--medium'>Modal Header</h2>
81+
<h2 className='slds-text-heading--medium'>{this.props.title}</h2>
7982
<SLDSButton className='slds-button slds-modal__close' onClick={this.closeModal}>
8083
<Icon name='close' category='utility' size='small'/>
8184
<span className='slds-assistive-text'>Close</span>
8285
</SLDSButton>
86+
{this.props.children}
87+
88+
</div>
89+
90+
<div className='slds-modal__footer'>
91+
{this.props.footer}
8392
</div>
84-
{this.props.children}
93+
8594
</div>
95+
8696
</div>
97+
8798
</Modal>
8899
);
89100
},

demo/pages/HomePage/ModalSection.jsx

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import {default as PrismCode} from 'react-prism/lib/PrismCode';
1616
import {EventUtil} from '../../../components/utils';
1717
import SLDSDateInput from '../../../components/SLDSDateInput';
1818

19+
import SLDSModal from '../../../components/SLDSModal';
20+
21+
1922
const items = ['Paddy\'s Pub', 'Tyrell Corp', 'Paper St. Soap Company', 'Nakatomi Investments', 'Acme Landscaping', 'Acme Construction'];
2023

2124

@@ -95,25 +98,13 @@ module.exports = React.createClass( {
9598
Open Modal
9699
</SLDSButton>
97100

98-
<Modal
99-
isOpen={this.state.modalIsOpen}
100-
onRequestClose={this.closeModal}
101-
style={customStyles}
102-
overlayClassName='slds-modal-backdrop slds-modal-backdrop--open' >
103-
104-
<div className='slds-modal slds-fade-in-open'
105-
onClick={this.closeModal}>
106-
<div className='slds-modal__container' onClick={(e)=>{EventUtil.trap(e);}}>
107-
<div className='slds-modal__header'>
108-
<h2 className='slds-text-heading--medium'>Modal Header</h2>
109-
<SLDSButton className='slds-button slds-modal__close' onClick={this.closeModal}>
110-
111-
<Icon name='close' category='utility' size='small'/>
112-
113-
<span className='slds-assistive-text'>Close</span>
114-
</SLDSButton>
115-
</div>
116-
<div className='slds-modal__content'>
101+
<SLDSModal
102+
title={<span>Super Stuff</span>}
103+
footer={[
104+
<button className='slds-button slds-button--neutral' onClick={this.closeModal}>Cancel</button>,
105+
<button className='slds-button slds-button--neutral slds-button--brand' onClick={this.handleSubmitModal}>Save</button>
106+
]}
107+
isOpen={this.state.modalIsOpen}>
117108

118109
<SLDSButton flavor='brand' onClick={this.handleButtonClick}>
119110
Test Button
@@ -126,28 +117,21 @@ module.exports = React.createClass( {
126117
nostrud ad veniam nulla aute est. Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.</p>
127118
</div>
128119

129-
<SLDSDateInput />
130-
131-
<div>
132-
<p>Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis. Cillum sunt ad dolore
133-
quis aute consequat ipsum magna exercitation reprehenderit magna. Tempor cupidatat consequat elit dolor adipisicing.</p>
134-
<p>Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident. Eiusmod et adipisicing culpa deserunt
135-
nostrud ad veniam nulla aute est. Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.</p>
136-
</div>
137-
138-
</div>
120+
<SLDSModal
121+
title={<span>Super Stuff</span>}
122+
isOpen={true}>
139123

124+
AAA
140125

141-
<div className='slds-modal__footer'>
142-
<button className='slds-button slds-button--neutral' onClick={this.closeModal}>Cancel</button>
143-
<button className='slds-button slds-button--neutral slds-button--brand' onClick={this.handleSubmitModal}>Save</button>
144-
</div>
126+
<SLDSModal
127+
title={<span>Super Stuff</span>}
128+
isOpen={true}>BBB</SLDSModal>
145129

146-
</div>
130+
AAA
147131

148-
</div>
149-
</Modal>
132+
</SLDSModal>
150133

134+
</SLDSModal>
151135

152136
</div>
153137
</div>

0 commit comments

Comments
 (0)