Skip to content

Commit

Permalink
feat: motion
Browse files Browse the repository at this point in the history
  • Loading branch information
wkylin committed Dec 24, 2024
1 parent 8977262 commit 7c0f009
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 14 deletions.
18 changes: 15 additions & 3 deletions src/components/stateless/FixTabPanel/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import React from 'react'

Check failure on line 1 in src/components/stateless/FixTabPanel/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

ESLint

ESLint: Install the 'eslint' package

const FixTabPanel = ({ style, children }) => (
<div style={{ width: '100%', minHeight: 'calc(100vh - 232px)', ...style }}>{children}</div>
)
const FixTabPanel = React.forwardRef(({ style, children }, ref) => (
<div
ref={ref}
style={{
width: '100%',
height: 'calc(100vh - 204px)',
position: 'relative',
overflowX: 'hidden',
overflowY: 'auto',
...style,
}}
>
{children}
</div>
))

export default FixTabPanel
1 change: 1 addition & 0 deletions src/pages/layout/proTabs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const ProTabs = (props) => {
id="container"
tabBarStyle={{
zIndex: 2,
marginBottom: 0,
}}
activeKey={activeKey}
destroyInactiveTabPane={false}
Expand Down
24 changes: 20 additions & 4 deletions src/pages/motion/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useRef } from 'react'
import { motion, useAnimationControls, LayoutGroup } from 'motion/react'
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, LayoutGroup, useScroll } from 'motion/react'
import FixTabPanel from '@stateless/FixTabPanel'
import { is } from '@react-spring/shared'

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

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused import

Unused import { is } from '@react-spring/shared'

Expand Down Expand Up @@ -90,11 +90,27 @@ const ParallaxVert = () => {
const [listLabel, setListLabel] = useState(['JavaScript', 'html', 'css', 'webAssembly'])
const [isBig, setBigState] = useState(false)
const [leftState, setLeftState] = useState(false)
const scrollRef = useRef(null)

const { scrollYProgress } = useScroll({
container: scrollRef,
})

return (
<FixTabPanel>
<FixTabPanel ref={scrollRef}>
<h2>Hi, Motion</h2>

<motion.div

Check notice on line 102 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,
left: 0,
width: '100%',
height: 3,
backgroundColor: '#aaa',
borderRadius: '3px',
scaleX: scrollYProgress,

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

View workflow job for this annotation

GitHub Actions / Qodana for JS

Suspicious variable/parameter name combination

'scrollYProgress' should probably not be assigned to 'scaleX'
}}
></motion.div>
<motion.div

Check notice on line 114 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,
Expand Down
9 changes: 6 additions & 3 deletions src/pages/reactGantt/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useRef, useEffect } from 'react'

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

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused import

Unused import specifier useEffect

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

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused import

Unused import specifier useRef

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

View workflow job for this annotation

GitHub Actions / Qodana for JS

ESLint

ESLint: Install the 'eslint' package
import { Gantt, Willow } from 'wx-react-gantt'
import FixTabPanel from '@stateless/FixTabPanel'
import 'wx-react-gantt/dist/gantt.css'
const ReactGantt = () => {
const tasks = [
Expand Down Expand Up @@ -53,9 +54,11 @@ const ReactGantt = () => {
]

return (
<Willow>
<Gantt tasks={tasks} links={links} scales={scales} />
</Willow>
<FixTabPanel>
<Willow>
<Gantt tasks={tasks} links={links} scales={scales} />
</Willow>
</FixTabPanel>
)
}

Expand Down
9 changes: 5 additions & 4 deletions src/styles/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,27 @@ select:-webkit-autofill:active {
}

.layout-container {
overflow: auto;
overflow: hidden;
height: 100%;
width: 100%;
}

.layout-container .wui-ant-tabs-content > .wui-ant-tabs-tabpane {
padding: 16px;
padding: 0 4px 8px 8px;
}

.layout-container .pro-tabs {
z-index: 10;
margin-bottom: 0;
}

.layout-container .layout-tabpanel {
width: 100%;
min-height: calc(100vh - 232px);
min-height: calc(100vh - 204px);
display: flex;
justify-content: center;
align-items: center;
overflow: auto;
overflow: hidden;
}

@keyframes rotate {
Expand Down

0 comments on commit 7c0f009

Please sign in to comment.