Skip to content

Commit 286a856

Browse files
refactor: 💡 separate reusable styles (#1)
1 parent bd76650 commit 286a856

1 file changed

Lines changed: 17 additions & 24 deletions

File tree

src/components/hyperlink/index.ts

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import {
66
octoTailAnimated,
77
} from '../keyframes';
88

9+
const animationProperties = css`
10+
animation-duration: 560ms;
11+
animation-timing-function: ease-in-out;
12+
`;
13+
914
export interface HyperlinkProps {
1015
animation?: string;
1116
}
@@ -19,92 +24,80 @@ export const Hyperlink = styled.a<HyperlinkProps>`
1924
return css`
2025
&:hover ${PathOctoLeftEar} {
2126
animation-name: ${octoLeftEarAnimated};
22-
animation-duration: 560ms;
23-
animation-timing-function: ease-in-out;
27+
${animationProperties}
2428
}
2529
`;
2630
2731
case 'right-ear':
2832
return css`
2933
&:hover ${PathOctoRightEar} {
3034
animation-name: ${octoRightEarAnimated};
31-
animation-duration: 560ms;
32-
animation-timing-function: ease-in-out;
35+
${animationProperties}
3336
}
3437
`;
3538
3639
case 'ears':
3740
return css`
3841
&:hover ${PathOctoLeftEar} {
3942
animation-name: ${octoLeftEarAnimated};
40-
animation-duration: 560ms;
41-
animation-timing-function: ease-in-out;
43+
${animationProperties}
4244
}
4345
4446
&:hover ${PathOctoRightEar} {
4547
animation-name: ${octoRightEarAnimated};
46-
animation-duration: 560ms;
47-
animation-timing-function: ease-in-out;
48+
${animationProperties}
4849
}
4950
`;
5051
5152
case 'tail':
5253
return css`
5354
&:hover ${PathOctoTail} {
5455
animation-name: ${octoTailAnimated};
55-
animation-duration: 560ms;
56-
animation-timing-function: ease-in-out;
56+
${animationProperties}
5757
}
5858
`;
5959
6060
case 'tail-&-leftEar':
6161
return css`
6262
&:hover ${PathOctoLeftEar} {
6363
animation-name: ${octoLeftEarAnimated};
64-
animation-duration: 560ms;
65-
animation-timing-function: ease-in-out;
64+
${animationProperties}
6665
}
6766
6867
&:hover ${PathOctoTail} {
6968
animation-name: ${octoTailAnimated};
70-
animation-duration: 560ms;
71-
animation-timing-function: ease-in-out;
69+
${animationProperties}
7270
}
7371
`;
7472
7573
case 'tail-&-rightEar':
7674
return css`
7775
&:hover ${PathOctoRightEar} {
7876
animation-name: ${octoRightEarAnimated};
79-
animation-duration: 560ms;
80-
animation-timing-function: ease-in-out;
77+
${animationProperties}
8178
}
8279
8380
&:hover ${PathOctoTail} {
8481
animation-name: ${octoTailAnimated};
85-
animation-duration: 560ms;
86-
animation-timing-function: ease-in-out;
82+
${animationProperties}
8783
}
8884
`;
8985
9086
case 'all':
9187
return css`
9288
&:hover ${PathOctoTail} {
9389
animation-name: ${octoTailAnimated};
94-
animation-duration: 560ms;
95-
animation-timing-function: ease-in-out;
90+
${animationProperties}
9691
}
9792
9893
&:hover ${PathOctoLeftEar} {
9994
animation-name: ${octoLeftEarAnimated};
100-
animation-duration: 560ms;
101-
animation-timing-function: ease-in-out;
95+
${animationProperties}
10296
}
10397
10498
&:hover ${PathOctoRightEar} {
10599
animation-name: ${octoRightEarAnimated};
106-
animation-duration: 560ms;
107-
animation-timing-function: ease-in-out;
100+
${animationProperties}
108101
}
109102
`;
110103

0 commit comments

Comments
 (0)