Skip to content

Commit cedb1fb

Browse files
committed
latest state
1 parent bbfbdd2 commit cedb1fb

38 files changed

+16921
-211
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

stories/tests/complex.js renamed to _stories/tests/complex.js

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,59 +11,59 @@ const data = [
1111
name: 'Rare Wind',
1212
description: '#a8edea → #fed6e3',
1313
css: 'linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)',
14-
height: 150
14+
height: 150,
1515
},
1616
{
1717
name: 'Saint Petersburg',
1818
description: '#f5f7fa → #c3cfe2',
1919
css: 'linear-gradient(135deg, #c3cfe2 0%, #c3cfe2 100%)',
20-
height: 300
20+
height: 300,
2121
},
2222
{
2323
name: 'Deep Blue',
2424
description: '#e0c3fc → #8ec5fc',
2525
css: 'linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%)',
26-
height: 200
26+
height: 200,
2727
},
2828
{
2929
name: 'Ripe Malinka',
3030
description: '#f093fb → #f5576c',
3131
css: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)',
32-
height: 200
32+
height: 200,
3333
},
3434
{
3535
name: 'Near Moon',
3636
description: '#5ee7df → #b490ca',
3737
css: 'linear-gradient(135deg, #5ee7df 0%, #b490ca 100%)',
38-
height: 300
38+
height: 300,
3939
},
4040
{
4141
name: 'Wild Apple',
4242
description: '#d299c2 → #fef9d7',
4343
css: 'linear-gradient(135deg, #d299c2 0%, #fef9d7 100%)',
44-
height: 150
44+
height: 150,
4545
},
4646
{
4747
name: 'Ladoga Bottom',
4848
description: '#ebc0fd → #d9ded8',
4949
css: 'linear-gradient(135deg, #ebc0fd 0%, #d9ded8 100%)',
50-
height: 200
50+
height: 200,
5151
},
5252
{
5353
name: 'Sunny Morning',
5454
description: '#f6d365 → #fda085',
5555
css: 'linear-gradient(120deg, #f6d365 0%, #fda085 100%)',
56-
height: 200
56+
height: 200,
5757
},
5858
{
5959
name: 'Lemon Gate',
6060
description: '#96fbc4 → #f9f586',
6161
css: 'linear-gradient(to top, #96fbc4 0%, #f9f586 100%)',
62-
height: 400
63-
}
62+
height: 400,
63+
},
6464
]
6565

66-
export function List ({ children, config, items, keys, heights, ...rest }) {
66+
export function List({ children, config, items, keys, heights, ...rest }) {
6767
let totalHeight = 0
6868
let displayData = React.useMemo(
6969
() =>
@@ -88,16 +88,15 @@ export function List ({ children, config, items, keys, heights, ...rest }) {
8888
return { y, height }
8989
},
9090
config,
91-
trail: 100
91+
trail: 100,
9292
})
9393

9494
// // something in useTransition causes an infinite loop
9595

9696
return (
9797
<div
9898
style={{ position: 'relative', width: '100%', height: totalHeight }}
99-
{...rest}
100-
>
99+
{...rest}>
101100
{transitions.map(({ item, props, key }, index) => (
102101
<animated.div
103102
key={key}
@@ -108,7 +107,7 @@ export function List ({ children, config, items, keys, heights, ...rest }) {
108107
opacity: props.opacity,
109108
height: props.height,
110109
zIndex: displayData.length - index,
111-
transform: props.y.interpolate(y => `translate3d(0,${y}px,0)`)
110+
transform: props.y.interpolate(y => `translate3d(0,${y}px,0)`),
112111
}}
113112
children={children(item.child)}
114113
/>
@@ -120,22 +119,21 @@ export function List ({ children, config, items, keys, heights, ...rest }) {
120119
export class App extends Component {
121120
state = { data }
122121
shuffle = () => this.setState(state => ({ data: shuffle(state.data) }))
123-
componentDidMount () {
122+
componentDidMount() {
124123
setInterval(this.shuffle, 2500)
125124
}
126-
render () {
125+
render() {
127126
return (
128-
<div id='complex'>
127+
<div id="complex">
129128
<List
130-
className='main-list'
129+
className="main-list"
131130
items={this.state.data}
132131
keys={d => d.name}
133132
heights={d => d.height}
134-
config={{ mass: 3, tension: 100, friction: 40 }}
135-
>
133+
config={{ mass: 3, tension: 100, friction: 40 }}>
136134
{item => (
137-
<div className='cell'>
138-
<div className='details' style={{ backgroundImage: item.css }}>
135+
<div className="cell">
136+
<div className="details" style={{ backgroundImage: item.css }}>
139137
<h1>{item.name}</h1>
140138
<p>{item.description}</p>
141139
</div>

stories/tests/messageHub.js renamed to _stories/tests/messageHub.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { X } from 'react-feather'
55
import {
66
animated,
77
useTransition,
8-
config as defaultConfig
8+
config as defaultConfig,
99
} from '../../src/targets/web/hooks'
1010
import { testStories } from '../index'
1111

@@ -99,9 +99,9 @@ export const Life = styled(animated.div)`
9999

100100
let id = 0
101101

102-
function MessageHub ({
102+
function MessageHub({
103103
config = { tension: 125, friction: 20, precision: 0.1 },
104-
timeout = 100000
104+
timeout = 100000,
105105
}) {
106106
const [cancelMap] = useState(() => new WeakMap())
107107
const [refMap] = useState(() => new WeakMap())
@@ -133,7 +133,7 @@ function MessageHub ({
133133
// functional array configs don't seem to work, the code below would normally
134134
// define configs for the functional leave state above (3 calls, first uses duration)
135135
config: (item, state) =>
136-
state === 'leave' ? [{ duration: timeout }, config, config] : config
136+
state === 'leave' ? [{ duration: timeout }, config, config] : config,
137137
})
138138

139139
useEffect(
@@ -153,8 +153,7 @@ function MessageHub ({
153153
<Life style={{ right: life }} />
154154
<p>{item.msg}</p>
155155
<Button
156-
onClick={() => cancelMap.has(item) && cancelMap.get(item)()}
157-
>
156+
onClick={() => cancelMap.has(item) && cancelMap.get(item)()}>
158157
<X size={18} />
159158
</Button>
160159
</Content>
File renamed without changes.

stories/tests/springHook.js renamed to _stories/tests/springHook.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import {
33
useSpring,
44
animated,
55
config,
6-
useKeyframes
6+
useKeyframes,
77
} from '../../src/targets/web/hooks'
88
import { testStories } from '../index'
99
import './styles.css'
1010

11-
function TestSpring () {
11+
function TestSpring() {
1212
const ref = useRef(null)
1313
const [length, set] = useState(0)
1414
const props = useSpring({ dash: length, config: config.molasses })
@@ -17,16 +17,15 @@ function TestSpring () {
1717

1818
return (
1919
<svg
20-
width='180'
21-
viewBox='0 0 23 23'
22-
display={ref.current ? 'display' : 'none'}
23-
>
24-
<g fill='transparent' stroke='hotpink' strokeWidth='0.5'>
20+
width="180"
21+
viewBox="0 0 23 23"
22+
display={ref.current ? 'display' : 'none'}>
23+
<g fill="transparent" stroke="hotpink" strokeWidth="0.5">
2524
<animated.path
2625
ref={ref}
2726
strokeDasharray={length}
2827
strokeDashoffset={props.dash.interpolate(d => length - d)}
29-
d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'
28+
d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"
3029
/>
3130
</g>
3231
</svg>
@@ -58,7 +57,7 @@ const useScripting = useKeyframes.spring(async next => {
5857
await next({
5958
from: { left: '0%', top: '0%', width: '0%', height: '0%' },
6059
width: '100%',
61-
height: '100%'
60+
height: '100%',
6261
})
6362
while (true) {
6463
await next({ height: '50%' })
@@ -72,12 +71,12 @@ const useScripting = useKeyframes.spring(async next => {
7271
}
7372
})
7473

75-
function TestSpringKeyframe () {
74+
function TestSpringKeyframe() {
7675
const props = useScripting()
7776

7877
return (
7978
<div className="springRoot">
80-
<animated.div className='box2' style={props} />
79+
<animated.div className="box2" style={props} />
8180
</div>
8281
)
8382
}
File renamed without changes.

0 commit comments

Comments
 (0)