Skip to content

Commit 1e3f2ef

Browse files
committed
Add babel config to fix jsx error
1 parent cec1b9a commit 1e3f2ef

File tree

4 files changed

+95
-61
lines changed

4 files changed

+95
-61
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [
3+
"@babel/preset-react",
4+
"babel-preset-gatsby"
5+
]
6+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"gatsby"
1212
],
1313
"license": "MIT",
14+
"browserslist": "> 0.25%, not dead",
1415
"scripts": {
1516
"build": "gatsby build",
1617
"develop": "gatsby develop",
@@ -63,8 +64,10 @@
6364
"devDependencies": {
6465
"@babel/core": "^7.14.0",
6566
"@babel/eslint-parser": "^7.13.14",
67+
"@babel/preset-react": "^7.13.13",
6668
"@upstatement/eslint-config": "^1.0.0",
6769
"@upstatement/prettier-config": "^1.0.0",
70+
"babel-preset-gatsby": "^1.4.0",
6871
"eslint": "^7.25.0",
6972
"eslint-config-prettier": "^8.3.0",
7073
"eslint-plugin-jsx-a11y": "^6.4.1",

src/components/loader.js

Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { Helmet } from 'react-helmet';
33
import PropTypes from 'prop-types';
44
import anime from 'animejs';
55
import styled from 'styled-components';
6-
import { IconLoader, IconLogo } from '@components/icons';
7-
import { usePrefersReducedMotion } from '@hooks';
6+
import { IconLoader } from '@components/icons';
87

98
const StyledLoader = styled.div`
109
${({ theme }) => theme.mixins.flexCenter};
@@ -39,67 +38,41 @@ const StyledLoader = styled.div`
3938

4039
const Loader = ({ finishLoading }) => {
4140
const [isMounted, setIsMounted] = useState(false);
42-
const prefersReducedMotion = usePrefersReducedMotion();
4341

4442
const animate = () => {
4543
const loader = anime.timeline({
4644
complete: () => finishLoading(),
4745
});
4846

49-
if (prefersReducedMotion) {
50-
loader
51-
.add({
52-
targets: '#logo',
53-
delay: 500,
54-
duration: 700,
55-
easing: 'easeInOutQuart',
56-
opacity: 1,
57-
})
58-
.add({
59-
targets: '#logo',
60-
delay: 500,
61-
duration: 300,
62-
easing: 'easeInOutQuart',
63-
opacity: 0,
64-
})
65-
.add({
66-
targets: '.loader',
67-
duration: 200,
68-
easing: 'easeInOutQuart',
69-
opacity: 0,
70-
zIndex: -1,
71-
});
72-
} else {
73-
loader
74-
.add({
75-
targets: '#logo path',
76-
delay: 300,
77-
duration: 1500,
78-
easing: 'easeInOutQuart',
79-
strokeDashoffset: [anime.setDashoffset, 0],
80-
})
81-
.add({
82-
targets: '#logo #B',
83-
duration: 700,
84-
easing: 'easeInOutQuart',
85-
opacity: 1,
86-
})
87-
.add({
88-
targets: '#logo',
89-
delay: 500,
90-
duration: 300,
91-
easing: 'easeInOutQuart',
92-
opacity: 0,
93-
scale: 0.1,
94-
})
95-
.add({
96-
targets: '.loader',
97-
duration: 200,
98-
easing: 'easeInOutQuart',
99-
opacity: 0,
100-
zIndex: -1,
101-
});
102-
}
47+
loader
48+
.add({
49+
targets: '#logo path',
50+
delay: 300,
51+
duration: 1500,
52+
easing: 'easeInOutQuart',
53+
strokeDashoffset: [anime.setDashoffset, 0],
54+
})
55+
.add({
56+
targets: '#logo #B',
57+
duration: 700,
58+
easing: 'easeInOutQuart',
59+
opacity: 1,
60+
})
61+
.add({
62+
targets: '#logo',
63+
delay: 500,
64+
duration: 300,
65+
easing: 'easeInOutQuart',
66+
opacity: 0,
67+
scale: 0.1,
68+
})
69+
.add({
70+
targets: '.loader',
71+
duration: 200,
72+
easing: 'easeInOutQuart',
73+
opacity: 0,
74+
zIndex: -1,
75+
});
10376
};
10477

10578
useEffect(() => {
@@ -112,7 +85,9 @@ const Loader = ({ finishLoading }) => {
11285
<StyledLoader className="loader" isMounted={isMounted}>
11386
<Helmet bodyAttributes={{ class: `hidden` }} />
11487

115-
<div className="logo-wrapper">{prefersReducedMotion ? <IconLogo /> : <IconLoader />}</div>
88+
<div className="logo-wrapper">
89+
<IconLoader />
90+
</div>
11691
</StyledLoader>
11792
);
11893
};

yarn.lock

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@
963963
"@babel/types" "^7.4.4"
964964
esutils "^2.0.2"
965965

966-
"@babel/preset-react@^7.12.5":
966+
"@babel/preset-react@^7.12.5", "@babel/preset-react@^7.13.13":
967967
version "7.13.13"
968968
resolved "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.13.13.tgz#fa6895a96c50763fe693f9148568458d5a839761"
969969
integrity sha512-gx+tDLIE06sRjKJkVtpZ/t3mzCDOnPG+ggHZG9lffUbX8+wC739x20YQc9V35Do6ZAxaUc/HhVHIiOzz5MvDmA==
@@ -2849,6 +2849,27 @@ babel-preset-gatsby@^0.12.3:
28492849
gatsby-core-utils "^1.10.1"
28502850
gatsby-legacy-polyfills "^0.7.1"
28512851

2852+
babel-preset-gatsby@^1.4.0:
2853+
version "1.4.0"
2854+
resolved "https://registry.npmjs.org/babel-preset-gatsby/-/babel-preset-gatsby-1.4.0.tgz#9df83bde4ff89e1824dd84e18131023faa7ce504"
2855+
integrity sha512-AkWPgzR6TdMkmagG5VD8u5s/EAvTBJgaJWoU3mkGyoojxq9+ila7nQlau9MZhztKn3oGRx3jKuT2rv6samIIYw==
2856+
dependencies:
2857+
"@babel/plugin-proposal-class-properties" "^7.12.1"
2858+
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.12.1"
2859+
"@babel/plugin-proposal-optional-chaining" "^7.12.1"
2860+
"@babel/plugin-syntax-dynamic-import" "^7.8.3"
2861+
"@babel/plugin-transform-classes" "^7.12.1"
2862+
"@babel/plugin-transform-runtime" "^7.12.1"
2863+
"@babel/plugin-transform-spread" "^7.12.1"
2864+
"@babel/preset-env" "^7.12.1"
2865+
"@babel/preset-react" "^7.12.5"
2866+
"@babel/runtime" "^7.12.5"
2867+
babel-plugin-dynamic-import-node "^2.3.3"
2868+
babel-plugin-macros "^2.8.0"
2869+
babel-plugin-transform-react-remove-prop-types "^0.4.24"
2870+
gatsby-core-utils "^2.4.0"
2871+
gatsby-legacy-polyfills "^1.4.0"
2872+
28522873
babel-runtime@^6.26.0:
28532874
version "6.26.0"
28542875
resolved "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
@@ -3196,7 +3217,7 @@ browserify-zlib@^0.2.0:
31963217
dependencies:
31973218
pako "~1.0.5"
31983219

3199-
browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.12.2, browserslist@^4.14.5, browserslist@^4.16.6:
3220+
browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.12.2, browserslist@^4.14.5, browserslist@^4.16.3, browserslist@^4.16.6:
32003221
version "4.16.6"
32013222
resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz#d7901277a5a88e554ed305b183ec9b0c08f66fa2"
32023223
integrity sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==
@@ -4056,6 +4077,14 @@ copyfiles@^2.3.0:
40564077
untildify "^4.0.0"
40574078
yargs "^16.1.0"
40584079

4080+
4081+
version "3.9.0"
4082+
resolved "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.9.0.tgz#29da39385f16b71e1915565aa0385c4e0963ad56"
4083+
integrity sha512-YK6fwFjCOKWwGnjFUR3c544YsnA/7DoLL0ysncuOJ4pwbriAtOpvM2bygdlcXbvQCQZ7bBU9CL4t7tGl7ETRpQ==
4084+
dependencies:
4085+
browserslist "^4.16.3"
4086+
semver "7.0.0"
4087+
40594088
core-js-compat@^3.6.5, core-js-compat@^3.9.0, core-js-compat@^3.9.1:
40604089
version "3.11.3"
40614090
resolved "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.11.3.tgz#031b4b4b92fe7066c4c56da6cf6b540c22849389"
@@ -5980,7 +6009,7 @@ file-type@^12.0.0:
59806009
resolved "https://registry.npmjs.org/file-type/-/file-type-12.4.2.tgz#a344ea5664a1d01447ee7fb1b635f72feb6169d9"
59816010
integrity sha512-UssQP5ZgIOKelfsaB5CuGAL+Y+q7EmONuiwF3N5HAH0t27rvrttgi6Ra9k/+DVaY9UF6+ybxu5pOXLUdA8N7Vg==
59826011

5983-
file-type@^16.0.0:
6012+
file-type@^16.0.0, file-type@^16.2.0:
59846013
version "16.4.0"
59856014
resolved "https://registry.npmjs.org/file-type/-/file-type-16.4.0.tgz#464197e44bd94a452d77b09085d977ae0dad2df4"
59866015
integrity sha512-MDAkwha3wHg11Lp++2T3Gu347eC/DB4r7nYj6iZaf1l7UhGBh2746QKxg0BWC8w2dJsxUEmH8KvLueX+GthN2w==
@@ -6382,6 +6411,20 @@ gatsby-core-utils@^1.10.1:
63826411
tmp "^0.2.1"
63836412
xdg-basedir "^4.0.0"
63846413

6414+
gatsby-core-utils@^2.4.0:
6415+
version "2.4.0"
6416+
resolved "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-2.4.0.tgz#79fc058913450fa8d6e9dc065db2e7912658e5c8"
6417+
integrity sha512-vGsPnEFSI+9ZcCVLB2am2eWnleadljUc+zDngea2szam/YUBxq2kSlNfpzlSSWpGyiIIHXXuSc0ttQOKgta1HQ==
6418+
dependencies:
6419+
ci-info "2.0.0"
6420+
configstore "^5.0.1"
6421+
file-type "^16.2.0"
6422+
fs-extra "^8.1.0"
6423+
node-object-hash "^2.0.0"
6424+
proper-lockfile "^4.1.1"
6425+
tmp "^0.2.1"
6426+
xdg-basedir "^4.0.0"
6427+
63856428
gatsby-graphiql-explorer@^0.11.0:
63866429
version "0.11.0"
63876430
resolved "https://registry.npmjs.org/gatsby-graphiql-explorer/-/gatsby-graphiql-explorer-0.11.0.tgz#2fe20ddb756180cf3a86defb2f24326ba0c9b062"
@@ -6405,6 +6448,13 @@ gatsby-legacy-polyfills@^0.7.1:
64056448
dependencies:
64066449
core-js-compat "^3.6.5"
64076450

6451+
gatsby-legacy-polyfills@^1.4.0:
6452+
version "1.4.0"
6453+
resolved "https://registry.npmjs.org/gatsby-legacy-polyfills/-/gatsby-legacy-polyfills-1.4.0.tgz#83c8bbc303dbbea632acb7b8e1a45b25222b520a"
6454+
integrity sha512-nD0eGo2kvuoXmzGEUP2Us0SUE9gk1r6oIcFDlwZZ6vZjRL5iHA7XG+9AUIwb3GWg3/kuBowkJH1wcwP/MJYwXQ==
6455+
dependencies:
6456+
core-js-compat "3.9.0"
6457+
64086458
gatsby-link@^2.11.0:
64096459
version "2.11.0"
64106460
resolved "https://registry.npmjs.org/gatsby-link/-/gatsby-link-2.11.0.tgz#15e99c89bdde1c99686ce53bda72beb3c9c39455"

0 commit comments

Comments
 (0)