Skip to content

Commit c69a81a

Browse files
committed
Dropdown Animasyon Düzenlemeleri Yapıldı.
1 parent 7197609 commit c69a81a

3 files changed

Lines changed: 41 additions & 20 deletions

File tree

example/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export class App extends Component {
178178
onSelect={(i) => {
179179
console.log(`${i}'nci nesne seçildi`)
180180
}}
181-
animationPosition='southeast'/>
181+
animationPosition='southwest'/>
182182
}/>
183183
</div>
184184

src/Dropdown/Dropdown.css

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@
77
padding: 5px 10px;
88
background: #f5f5f5;
99
border-radius: 5px;
10-
display: flex;
10+
display: none;
1111
flex-direction: row;
1212
align-items: center;
1313
justify-content: center;
1414
transform: scale(0);
1515
position: absolute;
1616
box-shadow: 0px 5px 5px -5px rgba(0, 0, 0, 0.75);
1717
transform-origin: left top;
18-
animation: dropdown-scaling 0.5s ease forwards;
1918
z-index: 99999;
2019
}
2120

21+
.rce-dropdown.dropdown-show{
22+
animation: dropdown-scaling 0.2s ease forwards;
23+
display: flex;
24+
}
25+
2226
@keyframes dropdown-scaling {
2327
0% {
2428
opacity: 0;
@@ -33,6 +37,26 @@
3337
}
3438
}
3539

40+
.rce-dropdown.dropdown-hide{
41+
animation: dropdown-reverse-scaling 0.2s ease forwards;
42+
display: flex;
43+
}
44+
45+
@keyframes dropdown-reverse-scaling {
46+
0% {
47+
opacity: 1;
48+
transform: scale(1);
49+
}
50+
50% {
51+
opacity: 0.5;
52+
transform: scale(1.1);
53+
}
54+
100% {
55+
opacity: 0;
56+
transform: scale(0);
57+
}
58+
}
59+
3660
.rce-dropdown-open__nortwest {
3761
transform-origin: left top;
3862
left: 0;

src/Dropdown/Dropdown.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ export class Dropdown extends Component {
1010
super(props);
1111

1212
this.state = {
13-
show: false,
13+
show: undefined,
1414
};
1515
}
1616

1717
onBlur(e) {
18-
// if (this.state.show === true)
19-
// this.setState({show: false});
18+
if (this.state.show === true)
19+
this.setState({show: false});
2020
}
2121

2222
render() {
@@ -25,18 +25,16 @@ export class Dropdown extends Component {
2525
{
2626
<Button
2727
{...this.props.buttonProps}
28-
onClick={() => this.setState({show: !this.state.show})}/>
28+
onClick={() => this.setState({ show: !this.state.show })} />
2929
}
30-
{
31-
this.state.show &&
32-
<div
33-
className={
34-
classNames(
35-
'rce-dropdown',
36-
this.props.animationType,
37-
'rce-dropdown-open__' + this.props.animationPosition,
38-
)
39-
}>
30+
<div
31+
className={classNames(
32+
'rce-dropdown',
33+
this.props.animationType,
34+
'rce-dropdown-open__' + this.props.animationPosition,
35+
{ 'dropdown-hide': this.state.show === false },
36+
{ 'dropdown-show': this.state.show === true })}>
37+
4038
<ul>
4139
{
4240
this.props.items.map((x, i) => (
@@ -46,16 +44,15 @@ export class Dropdown extends Component {
4644
))
4745
}
4846
</ul>
49-
</div>
50-
}
47+
</div>
5148
</div>
5249
);
5350
}
5451
}
5552

5653
Dropdown.defaultProps = {
5754
animationType: 'default',
58-
animationPosition: 'nortwest',
55+
animationPosition: 'southwest',
5956
items: [],
6057
onSelect: Function,
6158
buttonProps: null

0 commit comments

Comments
 (0)