Skip to content

Commit

Permalink
fix(xod-client): make sidebars not affected by workspace width
Browse files Browse the repository at this point in the history
Closes #1087
  • Loading branch information
evgenykochetkov committed Feb 19, 2019
1 parent e3055e2 commit e6c0dad
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $color-tabs-hover-text: $white;
$color-tabs-debugger-background: #3d4931;
$color-tabs-debugger-text: #82b948;

$sidebar-width: 200px;
$sidebar-width: 202px;

$sidebar-color-bg: $chrome-bg;
$sidebar-color-bg-even: $chrome-bg;
Expand Down
17 changes: 14 additions & 3 deletions packages/xod-client/src/core/styles/components/Editor.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
.Editor {
flex-grow: 1;

display: flex;
flex-direction: row;
align-items: stretch;
display: grid;
grid-template-columns: 100%;

&.leftSidebarMaximized {
grid-template-columns: $sidebar-width calc(100% - #{$sidebar-width});
}

&.rightSidebarMaximized {
grid-template-columns: calc(100% - #{$sidebar-width}) $sidebar-width;
}

&.leftSidebarMaximized.rightSidebarMaximized {
grid-template-columns: $sidebar-width calc(100% - #{$sidebar-width * 2}) $sidebar-width;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
flex-direction: column;
flex-wrap: nowrap;
flex-shrink: 0;
box-sizing: content-box;
box-sizing: border-box;

background: $sidebar-color-bg;

Expand Down
13 changes: 12 additions & 1 deletion packages/xod-client/src/editor/containers/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,19 @@ class Editor extends React.Component {
/>
) : null;

const areSidebarsMaximized = R.compose(
R.map(R.pipe(R.filter(R.prop('maximized')), R.isEmpty, R.not)),
R.groupBy(R.prop('sidebar')),
R.values
)(this.props.panelsSettings);

return (
<HotKeys
handlers={this.getHotkeyHandlers()}
className="Editor"
className={cn('Editor', {
leftSidebarMaximized: areSidebarsMaximized[SIDEBAR_IDS.LEFT],
rightSidebarMaximized: areSidebarsMaximized[SIDEBAR_IDS.RIGHT],
})}
id="Editor"
>
<Sidebar id={SIDEBAR_IDS.LEFT} windowSize={this.props.size} />
Expand Down Expand Up @@ -303,6 +312,7 @@ Editor.propTypes = {
project: PropTypes.object,
currentTab: sanctuaryPropType($Maybe($.Object)),
attachmentEditorTabs: PropTypes.array,
panelsSettings: PropTypes.object.isRequired,
searchPatches: PropTypes.func.isRequired,
isHelpboxVisible: PropTypes.bool,
isDebugSessionRunning: PropTypes.bool,
Expand Down Expand Up @@ -354,6 +364,7 @@ const mapStateToProps = R.applySpec({
isDebugSessionOutdated: DebuggerSelectors.isDebugSessionOutdated,
defaultNodePosition: EditorSelectors.getDefaultNodePlacePosition,
isTabtestRunning: EditorSelectors.isTabtestRunning,
panelsSettings: EditorSelectors.getAllPanelsSettings,
});

const mapDispatchToProps = dispatch => ({
Expand Down

0 comments on commit e6c0dad

Please sign in to comment.