Skip to content

Commit 4773a76

Browse files
committed
feat: update example
1 parent 718b45a commit 4773a76

File tree

4 files changed

+51
-24
lines changed

4 files changed

+51
-24
lines changed

examples/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"typescript": "^3.0.3"
2828
},
2929
"dependencies": {
30+
"or-icons": "^1.3.0",
3031
"react": "^16.1.1",
3132
"react-dom": "^16.1.1",
3233
"react-scripts": "^2.0.3"

examples/stories/example.tsx

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Button from 'or-button'
22
import React from 'react'
33

4+
import { SvgClose } from 'or-icons'
45
import Modal from 'or-modal'
56

67
export class Example extends React.Component {
@@ -14,7 +15,7 @@ export class Example extends React.Component {
1415
<div>
1516
<div className="example-wrapper">
1617
<Button type="primary" onClick={this.handelOpen('isOpenCenter')}>
17-
Open default center
18+
Open default Center
1819
</Button>
1920
<Modal
2021
classname="modal-center"
@@ -27,17 +28,11 @@ export class Example extends React.Component {
2728
className="close-icon"
2829
onClick={this.handleClose('isOpenCenter')}
2930
>
30-
<svg
31+
<SvgClose
3132
className="or-modal-close-icon"
32-
fill="#000"
33-
height="30"
34-
viewBox="0 0 24 24"
35-
width="30"
36-
xmlns="http://www.w3.org/2000/svg"
37-
>
38-
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
39-
<path d="M0 0h24v24H0z" fill="none" />
40-
</svg>
33+
fill="#333"
34+
size="30"
35+
/>
4136
</div>
4237
<div className="slogan">
4338
<div>LIFE IS SHORT</div>
@@ -67,18 +62,12 @@ export class Example extends React.Component {
6762
>
6863
<div>
6964
<div className="title-wrapper">
70-
<svg
65+
<SvgClose
7166
className="or-modal-close-icon"
7267
fill="#777"
73-
height="25"
74-
viewBox="0 0 24 24"
75-
width="25"
76-
xmlns="http://www.w3.org/2000/svg"
68+
size="25"
7769
onClick={this.handleClose('isOpenRight')}
78-
>
79-
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
80-
<path d="M0 0h24v24H0z" fill="none" />
81-
</svg>
70+
/>
8271
<div className="title">Account</div>
8372
</div>
8473
<div className="fast-sign">
@@ -113,6 +102,44 @@ export class Example extends React.Component {
113102
</div>
114103
</Modal>
115104
</div>
105+
<div className="example-wrapper">
106+
<Button type="primary" onClick={this.handelOpen('isOpenCenter')}>
107+
Modal can't be closed by clicking overlay
108+
</Button>
109+
<Modal
110+
classname="modal-center"
111+
isOpen={this.state.isOpenCenter}
112+
isClosedOnOverlayClick={false}
113+
onClose={this.handleClose('isOpenCenter')}
114+
>
115+
<div>
116+
<div className="right-side">
117+
<div
118+
className="close-icon"
119+
onClick={this.handleClose('isOpenCenter')}
120+
>
121+
<SvgClose
122+
className="or-modal-close-icon"
123+
fill="#333"
124+
size="30"
125+
/>
126+
</div>
127+
<div className="slogan">
128+
<div>LIFE IS SHORT</div>
129+
<div>BUY A</div>
130+
<div>LIPSTICK</div>
131+
</div>
132+
<Button
133+
type="primary"
134+
onClick={this.handleClose('isOpenCenter')}
135+
>
136+
SHOP NOW
137+
</Button>
138+
</div>
139+
<div className="footer">@Rice here 2018</div>
140+
</div>
141+
</Modal>
142+
</div>
116143
</div>
117144
)
118145
}

examples/stories/styles.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
position: absolute;
5252
bottom: 5px;
5353
left: 10px;
54-
// transform: translateX(-50%);
5554
}
5655
}
5756
}

src/Modal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ interface Props {
1515
isOpen: boolean
1616

1717
/**
18-
* the positon of the modal related to the window
18+
* determine the positon of the modal related to the window
1919
* @default 'center'
2020
**/
2121
position?: 'left' | 'right' | 'bottom' | 'center'
2222

2323
/**
24-
* whether the modal is closed when click the overlay
24+
* Determine whether you can close modal by clicking overlay
2525
* @default true
2626
**/
2727
isClosedOnOverlayClick?: boolean
@@ -32,7 +32,7 @@ interface Props {
3232
children: React.ReactElement<any>
3333

3434
/**
35-
* callback triggered by close the modal
35+
* callback triggered by closing the modal
3636
**/
3737
onClose?: () => void
3838
}

0 commit comments

Comments
 (0)