-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
82 lines (75 loc) · 2.21 KB
/
index.js
File metadata and controls
82 lines (75 loc) · 2.21 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React, { PureComponent } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { $get } from "plow-js";
import { selectors } from "@neos-project/neos-ui-redux-store";
import { Icon, Button } from "@neos-project/react-ui-components";
@connect((state) => {
const isDirty = selectors.UI.Inspector.isDirty(state);
const shouldPromptToHandleUnappliedChanges = selectors.UI.Inspector.shouldPromptToHandleUnappliedChanges(
state
);
const unappliedChangesOverlayIsVisible =
isDirty && !shouldPromptToHandleUnappliedChanges;
return {
isFringeLeft: $get("ui.leftSideBar.isHidden", state),
isFringeRight: $get("ui.rightSideBar.isHidden", state),
isFullScreen: $get("ui.fullScreen.isFullScreen", state),
unappliedChangesOverlayIsVisible,
};
})
export default class SecondaryInspector extends PureComponent {
static propTypes = {
isFringeLeft: PropTypes.bool.isRequired,
isFringeRight: PropTypes.bool.isRequired,
unappliedChangesOverlayIsVisible: PropTypes.bool.isRequired,
// Interaction related propTypes.
onClose: PropTypes.func.isRequired,
children: PropTypes.element.isRequired,
};
render() {
const {
onClose,
children,
isFringeLeft,
isFringeRight,
unappliedChangesOverlayIsVisible,
} = this.props;
const style = {
position: "absolute",
top: 82,
right: isFringeRight ? 0 : 320,
left: isFringeLeft ? 0 : 320,
bottom: 0,
background: "#222",
height: "calc(100% - 82px)",
border: "1px solid #222",
transition: ".25s ease left, .25s ease right",
willChange: "left, right",
zIndex: unappliedChangesOverlayIsVisible ? 2 : 1,
};
return (
<div style={style}>
<div
style={{
position: "absolute",
top: 0,
right: 0,
width: 40,
height: 40,
padding: 0,
fontSize: 18,
borderRightWidth: 0,
borderTopWidth: 0,
zIndex: 2,
}}
>
<Button style="clean" onClick={onClose}>
<Icon icon="times" />
</Button>
</div>
{children}
</div>
);
}
}