@@ -14,120 +14,106 @@ const Wrapper = styled('a', {
14
14
cursor : 'pointer' ,
15
15
overflow : 'hidden' ,
16
16
diplay : 'block' ,
17
+ position : 'relative' ,
17
18
18
19
'.main-text' : {
19
- diplay : 'block' ,
20
- transform : translateY ( 0 ) ,
20
+ display : 'block' ,
21
21
transition : 'transform 500ms'
22
22
} ,
23
23
24
- '&:before' : {
25
- content : '' ,
24
+ '.hover-text' : {
25
+ diplay : 'block' ,
26
+ transform : 'translateY(100%)' ,
27
+ transition : 'transform 500ms' ,
26
28
position : 'absolute' ,
27
- top : '50%' ,
28
- left : '50%' ,
29
- width : '140px' ,
30
- height : '140px' ,
31
- borderRadius : '50%' ,
32
- transform : 'translate3d(-50%,-50%,0) scale3d(0,0,0)' ,
33
- transition : 'opacity .4s cubic-bezier(.19,1,.22,1),transform .75s cubic-bezier(.19,1,.22,1)' ,
34
- backgroundColor : 'hsl(244, 63%, 69%)' ,
35
- opacity : 0
29
+ top : 0 ,
30
+ left : 0 ,
31
+ width : '100%' ,
32
+ height : '100%'
36
33
} ,
37
34
38
35
'&:hover' : {
39
- '&:before' : {
40
- opacity : 1 ,
41
- transitionDuration : '.85s' ,
42
- transform : 'translate3d(-50%,-50%,0) scale3d(1.2,1.2,1.2)'
36
+ '.main-text' : {
37
+ transition : 'transform 250ms' ,
38
+ transform : 'translateY(-100%)'
43
39
} ,
44
40
45
- span : {
46
- color : '$white'
41
+ '.hover-text' : {
42
+ transition : 'transform 250ms' ,
43
+ transform : 'translateY(0%)'
47
44
}
48
45
}
49
46
} ) ;
50
47
51
48
const cssStyling = `
52
49
.exampleBtn {
53
- padding: 12px 24px;
54
- background-color: hsl(222, 100%, 95%);
55
- color: hsl(243, 80%, 62%);
56
- position: relative;
57
- border-radius: 6px;
58
- overflow: hidden;
59
- z-index: 1;
50
+ color: 'white';
51
+ cursor: 'pointer';
52
+ overflow: 'hidden';
53
+ diplay: 'block';
54
+ position: 'relative';
60
55
}
61
56
62
- .exampleBtn span {
63
- z-index: 1 ;
64
- position: relative ;
57
+ .main-text {
58
+ display: block ;
59
+ transition: transform 500ms ;
65
60
}
66
61
67
- .exampleBtn::before {
68
- content: '';
69
- position: absolute;
70
- top: 50%;
71
- left: 50%;
72
- width: 140px;
73
- height: 140px;
74
- border-radius: 50%;
75
- transform: translate3d(-50%,-50%,0) scale3d(0,0,0);
76
- transition: opacity .4s cubic-bezier(.19,1,.22,1),transform .75s cubic-bezier(.19,1,.22,1);
77
- background-color: hsl(243, 80%, 62%);
78
- opacity: 0;
62
+ .hover-text {
63
+ transition: transform 250ms;
64
+ transform: translateY(0%);
65
+ position: absolute;
66
+ top: 0;
67
+ left: 0;
68
+ width: 100%;
69
+ height: 100%;
79
70
}
80
71
81
- .exampleBtn:hover span {
82
- color: hsl(222, 100%, 95%);
72
+ .exampleBtn:hover .main-text {
73
+ transition: transform 250ms;
74
+ transform: translateY(-100%);
83
75
}
84
76
85
- .exampleBtn:hover::before {
86
- opacity: 1;
87
- transition-duration: .85s;
88
- transform: translate3d(-50%,-50%,0) scale3d(1.2,1.2,1.2);
77
+ .exampleBtn:hover .hover-text {
78
+ transition: transform 250ms;
79
+ transform: translateY(0%);
89
80
}
81
+
90
82
` ;
91
83
92
84
const scssStyling = `
93
85
.exampleBtn {
94
- padding: 12px 24px;
95
- background-color: hsl(222, 100%, 95%);
96
- color: hsl(243, 80%, 62%);
97
- position: relative;
98
- border-radius: 6px;
99
- overflow: hidden;
100
- z-index: 1;
101
-
102
- span {
103
- z-index: 1;
104
- position: relative;
86
+ color: 'white';
87
+ cursor: 'pointer';
88
+ overflow: 'hidden';
89
+ diplay: 'block';
90
+ position: 'relative';
91
+
92
+ .main-text {
93
+ display: block;
94
+ transition: transform 500ms;
105
95
}
106
96
107
- &:before {
108
- content: '';
97
+ .hover-text {
98
+ transition: transform 250ms;
99
+ transform: translateY(0%);
109
100
position: absolute;
110
- top: 50%;
111
- left: 50%;
112
- width: 140px;
113
- height: 140px;
114
- border-radius: 50%;
115
- transform: translate3d(-50%,-50%,0) scale3d(0,0,0);
116
- transition: opacity .4s cubic-bezier(.19,1,.22,1),transform .75s cubic-bezier(.19,1,.22,1);
117
- background-color: hsl(243, 80%, 62%);
118
- opacity: 0;
101
+ top: 0;
102
+ left: 0;
103
+ width: 100%;
104
+ height: 100%;
119
105
}
120
106
121
107
&:hover {
122
- span {
123
- color: hsl(222, 100%, 95%) ;
124
- }
125
-
126
- &:before {
127
- opacity: 1;
128
- transition-duration: .85s ;
129
- transform: translate3d(-50%,-50%,0) scale3d(1.2,1.2,1.2 );
130
- }
108
+ .main-text {
109
+ transition: transform 250ms ;
110
+ transform: translateY(-100%);
111
+ }
112
+
113
+ .hover-text {
114
+ transition: transform 250ms ;
115
+ transform: translateY(0% );
116
+ }
131
117
}
132
118
}
133
119
` ;
0 commit comments