Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit d05235f

Browse files
committed
Revert "Implement folder collapse/expand animation"
This reverts commit 5d38f33.
1 parent 5d38f33 commit d05235f

File tree

5 files changed

+15
-41
lines changed

5 files changed

+15
-41
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Changes to the library code should hot reload in the demo app
261261
262262
## What's missing
263263

264-
There are still a few features from the original implementation missing from this package. These are mainly related to saving and loading data as well as local storage.
264+
There are still a few features from the original implementation missing from this package. These are mainly related to saving and loading data as well as local storage. Animations for folder expanding/collapsing is also not currently implemented, but shouldn't be too hard to do.
265265
266266
For the first, I think the fact that this is now an NPM module sort of goes against it handling this sort of stuff. Google's original concept was basically a plug and play controller that could do everything if you just slam it into the browser and pass it an object. However, in module form, it's expected that you'll most likely be integrating this with an existing application. In that case, you'll probably have pretty specific needs around how you would like to save/load data into your GUI and so it's been left out for now.
267267

@@ -270,6 +270,7 @@ Local storage however is in the roadmap and will probably be done very soon.
270270
## Roadmap
271271

272272
- Loading and storing both default and preset data via `localStorage`
273+
- Animations for `DatFolder` expanding/collapsing
273274
- Time travel with undo/redo buttons
274275
- Better support for floating point `DatNumber`s (rounding etc.)
275276

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@
8484
"lodash.isundefined": "^3.0.1",
8585
"lodash.result": "^4.4.0",
8686
"lodash.set": "^4.2.0",
87-
"react-color": "^2.13.8",
88-
"react-spring": "^8.0.27"
87+
"react-color": "^2.13.8"
8988
},
9089
"devDependencies": {
9190
"@babel/core": "^7.5.4",

src/components/DatFolder.js

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { Component, cloneElement } from 'react';
22
import PropTypes from 'prop-types';
33
import cx from 'classnames';
4-
import { Spring, animated } from 'react-spring/renderprops.cjs';
54

65
export default class DatFolder extends Component {
76
static propTypes = {
@@ -21,34 +20,24 @@ export default class DatFolder extends Component {
2120

2221
constructor(props) {
2322
super(props);
24-
this.state = {
25-
initialRender: true,
26-
closed: props.closed
27-
};
23+
this.state = { closed: props.closed };
2824
}
2925

30-
componentDidMount = () =>
31-
this.setState({
32-
initialRender: false
33-
});
34-
3526
handleClick = () =>
36-
this.setState(prevState => ({
37-
closed: !prevState.closed
38-
}));
27+
this.setState(prevState => ({ closed: !prevState.closed }));
3928

40-
renderChildren = () => {
29+
renderChildren() {
4130
// Disable this rule to take title out of the props so nested folders can have unique titles.
4231
// eslint-disable-next-line no-unused-vars
4332
const { children, title, ...rest } = this.props;
4433

4534
return React.Children.map(children, child =>
4635
cloneElement(child, { ...rest })
4736
);
48-
};
37+
}
4938

5039
render() {
51-
const { closed, initialRender } = this.state;
40+
const { closed } = this.state;
5241
const { title, className, style } = this.props;
5342

5443
return (
@@ -63,18 +52,7 @@ export default class DatFolder extends Component {
6352
>
6453
{title}
6554
</div>
66-
<Spring
67-
native
68-
immediate={initialRender}
69-
to={{ height: closed ? 0 : 'auto' }}
70-
from={{ height: closed ? 'auto' : 0 }}
71-
>
72-
{animStyles => (
73-
<animated.ul style={animStyles}>
74-
{this.renderChildren()}
75-
</animated.ul>
76-
)}
77-
</Spring>
55+
<ul>{this.renderChildren()}</ul>
7856
</div>
7957
</li>
8058
);

src/style/_folder.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
.title {
2121
background: $folder-closed;
2222
}
23+
24+
ul {
25+
display: none;
26+
}
2327
}
2428
}

yarn.lock

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@
693693
"@babel/plugin-transform-react-jsx-self" "^7.0.0"
694694
"@babel/plugin-transform-react-jsx-source" "^7.0.0"
695695

696-
"@babel/runtime@^7.3.1", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5":
696+
"@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5":
697697
version "7.5.5"
698698
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132"
699699
integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ==
@@ -6320,7 +6320,7 @@ prompts@^2.0.1:
63206320
kleur "^3.0.3"
63216321
sisteransi "^1.0.3"
63226322

6323-
prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.2, prop-types@^15.7.2:
6323+
prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2:
63246324
version "15.7.2"
63256325
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
63266326
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -6409,14 +6409,6 @@ react-is@^16.8.1, react-is@^16.8.4:
64096409
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb"
64106410
integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw==
64116411

6412-
react-spring@^8.0.27:
6413-
version "8.0.27"
6414-
resolved "https://registry.yarnpkg.com/react-spring/-/react-spring-8.0.27.tgz#97d4dee677f41e0b2adcb696f3839680a3aa356a"
6415-
integrity sha512-nDpWBe3ZVezukNRandTeLSPcwwTMjNVu1IDq9qA/AMiUqHuRN4BeSWvKr3eIxxg1vtiYiOLy4FqdfCP5IoP77g==
6416-
dependencies:
6417-
"@babel/runtime" "^7.3.1"
6418-
prop-types "^15.5.8"
6419-
64206412
react@^16.8.4:
64216413
version "16.9.0"
64226414
resolved "https://registry.yarnpkg.com/react/-/react-16.9.0.tgz#40ba2f9af13bc1a38d75dbf2f4359a5185c4f7aa"

0 commit comments

Comments
 (0)