Skip to content

Commit a78d0db

Browse files
committed
fix modal transition
1 parent 6e25bf6 commit a78d0db

File tree

2 files changed

+29
-36
lines changed

2 files changed

+29
-36
lines changed

src/components/shared/Modal.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,18 @@ class Modal extends Component {
4242

4343
render () {
4444
return (
45-
<div className={'tcs-modal-trans' + (this.state.show ? ' show' : '')}>
46-
<div className="tcs-modal-mask" onClick={this.close}>
47-
<div className="tcs-modal" onClick={e => e.stopPropagation()}>
48-
<div className="tcs-header">
49-
<h2>{this.props.title}</h2>
50-
<div className="close" onClick={this.close}>
51-
<Cross/>
52-
</div>
45+
<div className={'tcs-modal-mask' + (this.state.show ? ' show' : '')} onClick={this.close}>
46+
<div className="tcs-modal" onClick={e => e.stopPropagation()}>
47+
<div className="tcs-header">
48+
<h2>{this.props.title}</h2>
49+
<div className="close" onClick={this.close}>
50+
<Cross/>
5351
</div>
52+
</div>
5453

55-
{this.props.children}
54+
{this.props.children}
5655

57-
<Footer/>
58-
</div>
56+
<Footer/>
5957
</div>
6058
</div>
6159
)

src/styles/modal.scss

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
@import '../conf';
22

3-
.tcs-modal-mask {
4-
position: fixed;
5-
z-index: 9998;
6-
top: 0;
7-
left: 0;
8-
width: 100%;
9-
height: 100%;
10-
background-color: rgba($back-colour, $back-colour, $back-colour, .6);
11-
}
12-
133
.tcs-modal {
144
max-width: 900px;
155
box-sizing: border-box;
@@ -22,6 +12,26 @@
2212
margin: 10px 4px 0;
2313
padding: 10px;
2414
}
15+
transition: all .3s ease;
16+
transform: translate(0, 40px);
17+
}
18+
19+
.tcs-modal-mask {
20+
position: fixed;
21+
z-index: 99998;
22+
top: 0;
23+
left: 0;
24+
width: 100%;
25+
height: 100%;
26+
background-color: rgba($back-colour, $back-colour, $back-colour, .6);
27+
opacity: 0;
28+
transition: all .3s ease;
29+
&.show {
30+
opacity: 1;
31+
.tcs-modal {
32+
transform: translate(0, 0);
33+
}
34+
}
2535
}
2636

2737
.tcs-header {
@@ -40,18 +50,3 @@
4050
float: right;
4151
}
4252
}
43-
44-
.tcs-modal-trans {
45-
opacity: 0;
46-
transition: all .3s ease;
47-
.tcs-modal {
48-
transition: all .3s ease;
49-
transform: translate(0, 40px);
50-
}
51-
&.show {
52-
opacity: 1;
53-
.tcs-modal {
54-
transform: translate(0, 0);
55-
}
56-
}
57-
}

0 commit comments

Comments
 (0)