Skip to content

Commit 4ec3d84

Browse files
committed
Add FlickUp effect
1 parent 4b72819 commit 4ec3d84

File tree

2 files changed

+67
-79
lines changed

2 files changed

+67
-79
lines changed

components/Snippets/FlickUp.js

Lines changed: 64 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,120 +14,106 @@ const Wrapper = styled('a', {
1414
cursor: 'pointer',
1515
overflow: 'hidden',
1616
diplay: 'block',
17+
position: 'relative',
1718

1819
'.main-text': {
19-
diplay: 'block',
20-
transform: translateY(0),
20+
display: 'block',
2121
transition: 'transform 500ms'
2222
},
2323

24-
'&:before': {
25-
content: '',
24+
'.hover-text': {
25+
diplay: 'block',
26+
transform: 'translateY(100%)',
27+
transition: 'transform 500ms',
2628
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%'
3633
},
3734

3835
'&: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%)'
4339
},
4440

45-
span: {
46-
color: '$white'
41+
'.hover-text': {
42+
transition: 'transform 250ms',
43+
transform: 'translateY(0%)'
4744
}
4845
}
4946
});
5047

5148
const cssStyling = `
5249
.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';
6055
}
6156
62-
.exampleBtn span {
63-
z-index: 1;
64-
position: relative;
57+
.main-text {
58+
display: block;
59+
transition: transform 500ms;
6560
}
6661
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%;
7970
}
8071
81-
.exampleBtn:hover span {
82-
color: hsl(222, 100%, 95%);
72+
.exampleBtn:hover .main-text {
73+
transition: transform 250ms;
74+
transform: translateY(-100%);
8375
}
8476
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%);
8980
}
81+
9082
`;
9183

9284
const scssStyling = `
9385
.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;
10595
}
10696
107-
&:before {
108-
content: '';
97+
.hover-text {
98+
transition: transform 250ms;
99+
transform: translateY(0%);
109100
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%;
119105
}
120106
121107
&: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+
}
131117
}
132118
}
133119
`;

components/Snippets/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import * as CircleScaleButton from './CircleScaleButton';
1313
import * as ThreeDotsLoader from './ThreeDotsLoader';
1414
import * as ScalePseudo from './ScalePseudo';
1515
import * as UnderlineRight from './UnderlineRight';
16+
import * as FlickUp from './FlickUp';
1617

1718
const allSnippets = [
1819
UnderlineLeftRight,
@@ -29,7 +30,8 @@ const allSnippets = [
2930
CircleScaleButton,
3031
ThreeDotsLoader,
3132
ScalePseudo,
32-
UnderlineRight
33+
UnderlineRight,
34+
FlickUp
3335
];
3436

3537
export default allSnippets;

0 commit comments

Comments
 (0)