Skip to content

Commit 8999a9c

Browse files
committed
Moved CollectionListRow to be a functional component
1 parent d2bff5b commit 8999a9c

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

client/modules/IDE/components/CollectionList/CollectionListRow.jsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ const CollectionListRowBase = (props) => {
2323
const [renameValue, setRenameValue] = useState('');
2424
const renameInput = useRef(null);
2525

26+
const closeAll = () => {
27+
setOptionsOpen(false);
28+
setRenameOpen(false);
29+
};
30+
31+
const updateName = () => {
32+
const isValid = renameValue.trim().length !== 0;
33+
if (isValid) {
34+
props.editCollection(props.collection.id, {
35+
name: renameValue.trim()
36+
});
37+
}
38+
};
39+
2640
const onFocusComponent = () => {
2741
setIsFocused(true);
2842
};
@@ -52,11 +66,6 @@ const CollectionListRowBase = (props) => {
5266
}
5367
};
5468

55-
const closeAll = () => {
56-
setOptionsOpen(false);
57-
setRenameOpen(false);
58-
};
59-
6069
const handleAddSketches = () => {
6170
closeAll();
6271
props.onAddSketches();
@@ -100,15 +109,6 @@ const CollectionListRowBase = (props) => {
100109
closeAll();
101110
};
102111

103-
const updateName = () => {
104-
const isValid = renameValue.trim().length !== 0;
105-
if (isValid) {
106-
props.editCollection(props.collection.id, {
107-
name: renameValue.trim()
108-
});
109-
}
110-
};
111-
112112
const renderActions = () => {
113113
const { mobile } = props;
114114
const userIsOwner = props.user.username === props.username;
@@ -264,4 +264,3 @@ function mapDispatchToPropsSketchListRow(dispatch) {
264264
export default withTranslation()(
265265
connect(null, mapDispatchToPropsSketchListRow)(CollectionListRowBase)
266266
);
267-

0 commit comments

Comments
 (0)