-
Notifications
You must be signed in to change notification settings - Fork 812
/
index.js
49 lines (43 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import electron from 'electron';
import PropTypes from 'prop-types';
import React from 'react';
import {connect, ExportsContainer} from '../../containers';
import Export from './export';
class Exports extends React.Component {
componentDidUpdate(prevProps) {
if (!prevProps.isMounted && this.props.isMounted) {
electron.ipcRenderer.send('exports-ready');
}
}
render() {
const {exports, cancel, openInEditor} = this.props;
return (
<div>
{
exports.map(exp => (
<Export
{...exp}
key={exp.createdAt}
cancel={() => cancel(exp.createdAt)}
openInEditor={() => openInEditor(exp.createdAt)}/>
))
}
<style jsx>{`
flex: 1;
overflow-y: auto;
`}</style>
</div>
);
}
}
Exports.propTypes = {
exports: PropTypes.arrayOf(PropTypes.object),
cancel: PropTypes.elementType,
openInEditor: PropTypes.elementType,
isMounted: PropTypes.bool
};
export default connect(
[ExportsContainer],
({exports, isMounted}) => ({exports, isMounted}),
({cancel, openInEditor}) => ({cancel, openInEditor})
)(Exports);