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 #621

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/components/container/landingPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const LandingPage = () => {
<Button
className={styles.rollback}
icon={<ArrowLeftOutlined style={{ fontSize: 18 }} />}
type="text"
size="large"
type='text'
size='large'
onClick={() => navigate('/')}
>
Roll Back
Expand Down
20 changes: 10 additions & 10 deletions src/components/container/musicPlayer/Seekbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ const Seekbar = ({ value, min, max, onInput, setSeekTime, appTime }) => {
}

return (
<div className="hidden flex-row items-center sm:flex">
<div className='hidden flex-row items-center sm:flex'>
<Rewind
size={16}
color="#FFF"
color='#FFF'
onClick={() => setSeekTime(appTime - 5)}
className="hidden text-white lg:mr-1 lg:block"
className='hidden text-white lg:mr-1 lg:block'
/>
<span className="mr-1 text-white">{value === 0 ? '0:00' : getTime(value)}</span>
<span className='mr-1 text-white'>{value === 0 ? '0:00' : getTime(value)}</span>
<input
type="range"
step="any"
type='range'
step='any'
value={value}
min={min}
max={max}
onInput={onInput}
className="mx-4 h-1 w-24 rounded-lg md:block md:w-56 2xl:mx-6 2xl:w-96"
className='mx-4 h-1 w-24 rounded-lg md:block md:w-56 2xl:mx-6 2xl:w-96'
/>
<span className="mb-0 text-white">{max === 0 ? '0:00' : getTime(max)}</span>
<span className='mb-0 text-white'>{max === 0 ? '0:00' : getTime(max)}</span>
<FastForward
size={16}
color="#FFF"
color='#FFF'
onClick={() => setSeekTime(appTime + 5)}
className="hidden text-white lg:ml-1 lg:block"
className='hidden text-white lg:ml-1 lg:block'
/>
</div>
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/hooks/useScrollIntoView/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ const useScrollIntoView = ({ offset = 0 }) => {
if (shouldScrollY) {
window.scrollTo({
top: shouldScrollY ? adjustedTop : scrollTop,
behavior: 'smooth',
behavior: 'smooth'
})
}

if (shouldScrollX) {
window.scrollTo({
left: shouldScrollX ? adjustedLeft : scrollLeft,
behavior: 'smooth',
behavior: 'smooth'
})
}

Expand All @@ -49,7 +49,7 @@ const useScrollIntoView = ({ offset = 0 }) => {

return {
scrollIntoView,
targetRef,
targetRef
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/hooks/useWebsocket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const useWebsocket = ({ url, verify }) => {
{ key: 0, value: '正在链接中' },
{ key: 1, value: '已经链接并且可以通讯' },
{ key: 2, value: '连接正在关闭' },
{ key: 3, value: '连接已关闭或者没有链接成功' },
{ key: 3, value: '连接已关闭或者没有链接成功' }
]
try {
ws.current = new WebSocket(url)
Expand Down Expand Up @@ -70,7 +70,7 @@ const useWebsocket = ({ url, verify }) => {
wsData,
readyState,
closeWebSocket,
reconnect,
reconnect
}
}
export default useWebsocket
6 changes: 3 additions & 3 deletions src/components/hooks/useWindowScroll/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const useWindowScroll = () => {
// 用于存储窗口滚动位置的状态
const [scroll, setScroll] = useState({
x: window.scrollX,
y: window.scrollY,
y: window.scrollY
})

// 用于更新滚动位置状态的函数
const handleScroll = () => {
setScroll({
x: window.scrollX,
y: window.scrollY,
y: window.scrollY
})
}

Expand All @@ -30,7 +30,7 @@ const useWindowScroll = () => {
setScroll: (newScroll) => {
window.scrollTo(newScroll.x, newScroll.y)
setScroll(newScroll)
},
}
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/components/stateful/TreeList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Index = forwardRef((props, ref) => {
selectedKeys, // 选中的节点
setSelectedKeys, // 选中外传函数
selectable = false, // 父级节点是否可以选中
params = {}, // 额外的参数
params = {} // 额外的参数
} = props
const [treeList, setTreeList] = useState([]) // 全量数据源列表
const [treeData, setTreeData] = useState([])
Expand Down Expand Up @@ -87,7 +87,7 @@ const Index = forwardRef((props, ref) => {
return {
...item,
key: itemPath,
...(item.children?.length ? { children: setPath(item.children, itemPath) } : {}),
...(item.children?.length ? { children: setPath(item.children, itemPath) } : {})
}
})
treeData = setPath(treeData)
Expand Down Expand Up @@ -123,7 +123,7 @@ const Index = forwardRef((props, ref) => {
const defaultKey = selectable
? {
selected: [treeData[0].key],
expanded: [treeData[0].key],
expanded: [treeData[0].key]
}
: getDefaultKey(treeData)
selected = defaultKey.selected
Expand All @@ -133,7 +133,7 @@ const Index = forwardRef((props, ref) => {
const defaultKey = selectable
? {
selected: [treeData[0].key],
expanded: [treeData[0].key],
expanded: [treeData[0].key]
}
: getDefaultKey(treeData)
selected = defaultKey.selected
Expand All @@ -159,7 +159,7 @@ const Index = forwardRef((props, ref) => {
})
selected = selectedKeys

function loop(params) {
function loop (params) {
return params.some((item) => {
if (item.realId === selectedKeys[0]) {
expanded = [item.key]
Expand All @@ -176,7 +176,7 @@ const Index = forwardRef((props, ref) => {
const defaultKey = selectable
? {
selected: [treeData[0].key],
expanded: [treeData[0].key],
expanded: [treeData[0].key]
}
: getDefaultKey(treeData)
selected = defaultKey.selected
Expand Down Expand Up @@ -214,14 +214,14 @@ const Index = forwardRef((props, ref) => {
expandedKeys,
setExpandedKeys,
setSelectedKeys: setFixSelectedKeys,
treeData,
treeData
}))

return (
<div className={`${styles.treeList} treeList`}>
<div>
{search && (
<Search placeholder="搜索" onSearch={onSearch} style={{ marginBottom: 10, width: '100%' }} allowClear />
<Search placeholder='搜索' onSearch={onSearch} style={{ marginBottom: 10, width: '100%' }} allowClear />
)}
<Tree
selectedKeys={!isEmpty(selectedKeys) ? selectedKeys : fixSelectedKeys}
Expand Down
4 changes: 2 additions & 2 deletions src/components/stateless/AnimInView/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { motion, useInView } from 'motion/react'

const defaultVariants = {
hidden: { opacity: 0 },
visible: { opacity: 1 },
visible: { opacity: 1 }
}

const AnimationInView = ({ children, variants = defaultVariants, transition, viewOptions, as = 'div' }) => {
Expand All @@ -15,7 +15,7 @@ const AnimationInView = ({ children, variants = defaultVariants, transition, vie
return (
<MotionComponent
ref={ref}
initial="hidden"
initial='hidden'
animate={isInView ? 'visible' : 'hidden'}
variants={variants}
transition={transition}
Expand Down
8 changes: 4 additions & 4 deletions src/components/stateless/AnimateRipple/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const useRippling = () => {
const { left, top } = e.currentTarget.getBoundingClientRect()
setCoordinates({
x: e.clientX - left,
y: e.clientY - top,
y: e.clientY - top
})

setTimeout(() => {
Expand All @@ -22,7 +22,7 @@ const useRippling = () => {
x,
y,
handleRippleOnClick,
isRippling,
isRippling
}
}

Expand All @@ -35,15 +35,15 @@ const AnimateRipple = ({ children, onClick, ...rest }) => {
}

return (
<button type="button" onClick={handleClick} className={styles.btn} {...rest}>
<button type='button' onClick={handleClick} className={styles.btn} {...rest}>
<span className={styles.content}>{children}</span>
{isRippling && (
<div className={styles['btn-ripple-container']}>
<span
className={styles['btn-ripple']}
style={{
left: x,
top: y,
top: y
}}
/>
</div>
Expand Down
Loading