Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Prettier and StandardJS #532

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions src/pages/motion/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useRef } from 'react'

Check warning on line 1 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused import

Unused import specifier useEffect

Check failure on line 1 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

ESLint

ESLint: Install the 'eslint' package
import {
motion,
useAnimationControls,
Expand Down Expand Up @@ -68,7 +68,7 @@
]

const randomSort = (arr) => {
let newArr = []
const newArr = []
const len = arr.length
for (let i = 0; i < len; i++) {
const random = Math.floor(Math.random() * arr.length)
Expand Down Expand Up @@ -98,7 +98,7 @@

const [listLabel, setListLabel] = useState(['JavaScript', 'html', 'css', 'webAssembly'])
const [isBig, setBigState] = useState(false)
const [leftState, setLeftState] = useState(false)

Check warning on line 101 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused local symbol

Unused constant leftState

Check warning on line 101 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused local symbol

Unused constant setLeftState

const scrollRef = useRef(null)

Expand Down Expand Up @@ -128,7 +128,7 @@
return (
<FixTabPanel ref={scrollRef}>
<h2>Hi, Motion</h2>
<motion.div

Check notice on line 131 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
position: 'fixed',
top: 0,
Expand All @@ -138,10 +138,10 @@
backgroundColor: '#aaa',
borderRadius: '3px',
// scaleX: scrollYProgress,
scaleX: scaleX,
scaleX,
}}
></motion.div>
/>
<motion.div

Check notice on line 144 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 100,
height: 100,
Expand All @@ -164,8 +164,8 @@
rotate: 45, // 旋转45度
opacity: 0.5, // 不透明度设置为0.5
}}
></motion.div>
/>
<motion.div

Check notice on line 168 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
transformTemplate={template}
animate={{ rotate: 360 }}
style={{
Expand All @@ -176,9 +176,9 @@
rotate: 0,
x: '200px',
}}
></motion.div>
/>

<motion.div

Check notice on line 181 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 100,
height: 100,
Expand All @@ -189,10 +189,10 @@
duration: 2,
}}
variants={animations}
initial={'hidden'}
animate={'show'}
></motion.div>
initial="hidden"
animate="show"
/>
<motion.ul

Check notice on line 195 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.ul
initial="hidden"
animate="visible"
variants={list}
Expand All @@ -203,12 +203,12 @@
}}
style={{ fontSize: 20 }}
>
<motion.li variants={item}>item1</motion.li>

Check notice on line 206 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.li
<motion.li variants={item}>item2</motion.li>

Check notice on line 207 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.li
<motion.li variants={item}>item3</motion.li>

Check notice on line 208 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.li
</motion.ul>
{['vue', 'react', 'angular'].map((item, i) => (
<motion.p style={{ fontSize: 20 }} key={i} custom={i + 0.3} animate="visible" variants={variantsText}>

Check notice on line 211 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.p
{item}
</motion.p>
))}
Expand All @@ -220,7 +220,7 @@
gap: 30,
}}
>
<motion.div

Check notice on line 223 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 100,
height: 100,
Expand All @@ -242,7 +242,7 @@
onClick={() => {
setRotate(!isRotated)
}}
></motion.div>
/>
<div
style={{
display: 'flex',
Expand All @@ -265,7 +265,7 @@
</div>
</div>

<motion.div

Check notice on line 268 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
display: 'flex',
flexDirection: 'column',
Expand All @@ -279,7 +279,7 @@
}}
ref={constraintsRef}
>
<motion.div

Check notice on line 282 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 100,
height: 100,
Expand All @@ -296,20 +296,17 @@
onDragStart={(event, info) => console.log(info.point.x, info.point.y)}
onDragEnd={(event, info) => console.log(info.point.x, info.point.y)}
onDirectionLock={(axis) => console.log('axis', axis)}
dragSnapToOrigin={true}
dragSnapToOrigin
// dragConstraints={{ left: 0, right: 300 }}
dragConstraints={constraintsRef}
// dragElastic={false}
// dragElastic={0.8}
// dragPropagation={false}
></motion.div>
/>
<div
style={{
display: 'flex',
gap: 20,
}}
>
<motion.div

Check notice on line 309 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={btnStyle}
onTap={() => {
controller.start({ scale: 1.2 })
Expand All @@ -317,7 +314,7 @@
>
</motion.div>
<motion.div

Check notice on line 317 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={btnStyle}
onTap={() => {
controller.start({ rotate: 45 })
Expand All @@ -325,7 +322,7 @@
>
旋转
</motion.div>
<motion.div

Check notice on line 325 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={btnStyle}
onClick={() => {
controller.start({ opacity: 0.2 })
Expand All @@ -333,7 +330,7 @@
>
透明度
</motion.div>
<motion.div

Check notice on line 333 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={btnStyle}
onTap={() => {
controller.start({ opacity: 1, rotate: 0, scale: 1.0 })
Expand All @@ -353,7 +350,7 @@
gap: 52,
}}
>
<motion.div

Check notice on line 353 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 100,
height: 100,
Expand All @@ -379,14 +376,14 @@
setIsAnimation(false)
console.log('Completed animating', definition)
}}
></motion.div>
/>
<div
style={{
display: 'flex',
gap: 20,
}}
>
<motion.div

Check notice on line 386 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
...btnStyle,
pointerEvents: isAnimation ? 'none' : 'auto',
Expand Down Expand Up @@ -438,7 +435,7 @@
}}
key={i}
>
<motion.div

Check notice on line 438 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 100,
height: 100,
Expand Down Expand Up @@ -498,7 +495,7 @@
marginTop: 30,
}}
>
<motion.div

Check notice on line 498 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 100,
height: 100,
Expand All @@ -512,10 +509,10 @@
duration: 1,
repeat: Infinity,
}}
></motion.div>
/>
</div>

<motion.div

Check notice on line 515 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 180,
backgroundColor: '#333',
Expand All @@ -529,7 +526,7 @@
setButtonState(!buttonRight)
}}
>
<motion.div

Check notice on line 529 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
layout // 设置在白色圆球元素上,即子元素上 <-
style={{
width: 60,
Expand All @@ -537,11 +534,11 @@
backgroundColor: 'white',
borderRadius: 60,
}}
></motion.div>
/>
</motion.div>

<section style={{ fontSize: 30 }}>scrollDirection: {scrollDirection}</section>
<motion.div

Check notice on line 541 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 200,
height: 100,
Expand All @@ -551,8 +548,8 @@
x,
rotate,
}}
></motion.div>
/>
<motion.div

Check notice on line 552 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 200,
height: 100,
Expand All @@ -560,7 +557,7 @@
borderRadius: '20px',
scaleX,
}}
></motion.div>
/>

<div
style={{
Expand All @@ -573,7 +570,7 @@
fontWeight: 'bold',
}}
>
<motion.div

Check notice on line 573 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
display: 'flex',
flexDirection: 'column',
Expand All @@ -583,7 +580,7 @@
>
{listLabel.map((item) => {
return (
<motion.div

Check notice on line 583 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
layout
style={{
width: 200,
Expand All @@ -600,7 +597,7 @@
</motion.div>
)
})}
<motion.div

Check notice on line 600 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 160,
height: 50,
Expand Down Expand Up @@ -635,7 +632,7 @@
fontSize: 16,
}}
>
<motion.div

Check notice on line 635 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: buttonRight ? 160 : 200,
height: 40,
Expand All @@ -650,9 +647,9 @@
onTap={() => {
setButtonState(!buttonRight)
}}
></motion.div>
/>

<motion.div

Check notice on line 652 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
width: 120,
height: 40,
Expand All @@ -670,7 +667,7 @@
onTap={() => {
setButtonState(!buttonRight)
}}
></motion.div>
/>
<span
style={{
color: '#aaa',
Expand All @@ -688,7 +685,7 @@
alignItems: 'center',
}}
>
<motion.div

Check notice on line 688 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
style={{
backgroundColor: '#333',
borderRadius: '10px',
Expand All @@ -701,7 +698,7 @@
layout
>
<LayoutGroup>
<motion.div

Check notice on line 701 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
layout
style={{
width: isBig ? 200 : 60,
Expand All @@ -719,9 +716,9 @@
setBigState(!isBig)
}}
>
<motion.span layout>click</motion.span>

Check notice on line 719 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.span
</motion.div>
<motion.div

Check notice on line 721 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
layout
style={{
width: 60,
Expand All @@ -729,8 +726,8 @@
backgroundColor: '#fff',
borderRadius: 10,
}}
></motion.div>
/>
<motion.div

Check notice on line 730 in src/pages/motion/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unresolved JSX component

Unresolved component motion.div
layout
style={{
width: 60,
Expand All @@ -738,7 +735,7 @@
backgroundColor: '#fff',
borderRadius: 10,
}}
></motion.div>
/>
</LayoutGroup>
</motion.div>
</div>
Expand Down
Loading