Skip to content

Commit 5615e69

Browse files
authored
refactor: Use pure react new life cycle method (#144)
* use father * init lint config * fix lint * typescript PopupInner * fix ref issue * Popup to ts * mock to ts * more ts * add align define * util add type define * clean up ts * move trigger ts define out * done ts define * fix lint * add motion define * remove LazyBox in Popup * rm LazyRenderBox * add case demo * update demo * add montionName support * add missing visible * use rc-util find dom node * step of stretch * add align logic * support motion and no-motion * fix visible logic * support leave motion * support no-motion leave * fix new re-render logic * move update logic into static * restore align * fix point logic * add comment * support legacy props * use new context * fix ci * add now * rm legacy lib * update test case * add nest test case * forcerender support * destroy test * basic test * point test case * update mock test * disable sort-comp
1 parent cc3104a commit 5615e69

39 files changed

+2794
-2564
lines changed

.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const base = require('@umijs/fabric/dist/eslint');
2+
3+
module.exports = {
4+
...base,
5+
rules: {
6+
...base.rules,
7+
'default-case': 0,
8+
'react/no-find-dom-node': 0,
9+
'react/no-did-update-set-state': 0,
10+
'react/no-unused-state': 1,
11+
'react/sort-comp': 0,
12+
'jsx-a11y/label-has-for': 0,
13+
'jsx-a11y/label-has-associated-control': 0,
14+
},
15+
};

.fatherrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
cjs: 'babel',
3+
esm: { type: 'babel', importLibToEs: true },
4+
preCommit: {
5+
eslint: true,
6+
prettier: true,
7+
},
8+
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.storybook
12
*.iml
23
*.log
34
.idea

.travis.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
language: node_js
22

3-
sudo: false
4-
5-
notifications:
6-
email:
7-
8-
93
node_js:
10-
- 6.9.1
4+
- 10
115

12-
before_install:
13-
- |
14-
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
15-
then
16-
echo "Only docs were updated, stopping build process."
17-
exit
18-
fi
19-
phantomjs --version
206
script:
217
- |
228
if [ "$TEST_TYPE" = test ]; then
23-
npm test
9+
npm run coverage && \
10+
bash <(curl -s https://codecov.io/bash)
2411
else
2512
npm run $TEST_TYPE
2613
fi
2714
env:
2815
matrix:
2916
- TEST_TYPE=lint
30-
- TEST_TYPE=test
31-
- TEST_TYPE=coverage
17+
- TEST_TYPE=test

examples/case.less

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// ======================= Popup =======================
2+
.case-motion {
3+
transform-origin: 50% 50%;
4+
5+
animation-duration: 0.3s;
6+
animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);
7+
animation-fill-mode: both;
8+
9+
&::after {
10+
content: 'Animating...';
11+
position: absolute;
12+
bottom: -3em;
13+
}
14+
15+
&-appear,
16+
&-enter {
17+
animation-play-state: paused;
18+
19+
&-active {
20+
animation-name: case-zoom-in;
21+
animation-play-state: running;
22+
}
23+
}
24+
25+
&-leave {
26+
animation-play-state: paused;
27+
28+
&-active {
29+
animation-name: case-zoom-out;
30+
animation-play-state: running;
31+
}
32+
}
33+
}
34+
35+
@keyframes case-zoom-in {
36+
0% {
37+
opacity: 0;
38+
transform: scale(0);
39+
}
40+
100% {
41+
opacity: 1;
42+
transform: scale(1);
43+
}
44+
}
45+
46+
@keyframes case-zoom-out {
47+
0% {
48+
opacity: 1;
49+
transform: scale(1);
50+
}
51+
100% {
52+
opacity: 0;
53+
transform: scale(1.2);
54+
}
55+
}
56+
57+
// ======================= Mask =======================
58+
.mask-motion {
59+
animation-duration: 0.3s;
60+
animation-fill-mode: both;
61+
position: fixed;
62+
left: 0;
63+
right: 0;
64+
top: 0;
65+
bottom: 0;
66+
background: rgba(0, 0, 0, 0.3);
67+
68+
&-appear,
69+
&-enter {
70+
animation-play-state: paused;
71+
opacity: 0;
72+
73+
&-active {
74+
animation-name: mask-zoom-in;
75+
animation-play-state: running;
76+
}
77+
}
78+
79+
&-leave {
80+
animation-play-state: paused;
81+
82+
&-active {
83+
animation-name: mask-zoom-out;
84+
animation-play-state: running;
85+
}
86+
}
87+
}
88+
89+
@keyframes mask-zoom-in {
90+
0% {
91+
opacity: 0;
92+
}
93+
100% {
94+
opacity: 1;
95+
}
96+
}
97+
98+
@keyframes mask-zoom-out {
99+
0% {
100+
opacity: 1;
101+
}
102+
100% {
103+
opacity: 0;
104+
}
105+
}

0 commit comments

Comments
 (0)