Skip to content

Commit

Permalink
#92 fix layout of grid containers
Browse files Browse the repository at this point in the history
  • Loading branch information
tibor-postek-m2ms committed Mar 2, 2020
1 parent 09f99a2 commit 6b32900
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
11 changes: 9 additions & 2 deletions js/components/nglView/nglView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { NglContext } from './nglProvider';
import { handleNglViewPick } from './redux/dispatchActions';
import { throttle } from 'lodash';
import { BACKGROUND_COLOR, NGL_PARAMS } from './constants';
import nglReducers from '../../reducers/ngl/nglReducers';

const NglView = memo(({ div_id, height, setOrientation, removeAllNglComponents, handleNglViewPick }) => {
// connect to NGL Stage object
Expand Down Expand Up @@ -102,7 +101,15 @@ const NglView = memo(({ div_id, height, setOrientation, removeAllNglComponents,
]);
// End of Initialization NGL View component

return <div id={div_id} style={{ height: height || '600px', width: '100%' }} />;
return (
<div
id={div_id}
style={{
height: height || '600px',
width: 'inherit'
}}
/>
);
});

function mapStateToProps(state) {
Expand Down
27 changes: 21 additions & 6 deletions js/components/preview/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ const useStyles = makeStyles(theme => ({
},
inheritWidth: {
width: 'inherit'
},
nglViewWidth: {
width: 'inherit'
},
hitColumn: {
[theme.breakpoints.between('lg', 'xl')]: {
maxWidth: 504,
marginRight: theme.spacing(1) / 4
}
},
summaryColumn: {
[theme.breakpoints.between('lg', 'xl')]: {
maxWidth: 504,
minWidth: 400
}
}
}));

Expand All @@ -44,7 +59,7 @@ const Preview = memo(({ isStateLoaded, headerHeight }) => {

const [viewControlsHeight, setViewControlsHeight] = useState(0);

const screenHeight = `calc(100vh - ${headerHeight}px - ${theme.spacing(2)}px - ${viewControlsHeight}px)`;
const screenHeight = `calc(100vh - ${headerHeight}px - ${theme.spacing(2)}px - ${viewControlsHeight}px )`;

const [summaryViewHeight, setSummaryViewHeight] = useState(0);

Expand All @@ -60,7 +75,7 @@ const Preview = memo(({ isStateLoaded, headerHeight }) => {
return (
<Fragment>
<Grid container justify="space-between" className={classes.root} spacing={1}>
<Grid item sm={12} md={5} lg={4} xl={3} container direction="column" spacing={1}>
<Grid item sm={12} md={5} lg xl container direction="column" spacing={1} className={classes.hitColumn}>
{/* Hit cluster selector */}
<Grid item>
<MolGroupSelector isStateLoaded={isStateLoaded} handleHeightChange={setMolGroupsHeight} />
Expand All @@ -74,9 +89,9 @@ const Preview = memo(({ isStateLoaded, headerHeight }) => {
/>
</Grid>
</Grid>
<Grid item sm={12} md={7} lg={5} xl={6}>
<Grid container direction="column" spacing={1}>
<Grid item className={classes.inheritWidth}>
<Grid item sm={12} md={5} lg xl>
<Grid container direction="column" spacing={1} className={classes.nglViewWidth}>
<Grid item>
<NGLView div_id={VIEWS.MAJOR_VIEW} height={screenHeight} />
</Grid>
<Grid item ref={nglViewerControlsRef}>
Expand All @@ -90,7 +105,7 @@ const Preview = memo(({ isStateLoaded, headerHeight }) => {
</Grid>
</Grid>
</Grid>
<Grid item sm={12} md={6} lg={3} xl={3} container direction="column" spacing={1}>
<Grid item sm={12} md={6} lg xl container direction="column" spacing={1} className={classes.summaryColumn}>
<Grid item>
<SummaryView setSummaryViewHeight={setSummaryViewHeight} summaryViewHeight={summaryViewHeight} />
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { getUrl, loadFromServer } from '../../../../utils/genericList';
import { OBJECT_TYPE } from '../../../nglView/constants';
import { SCENES } from '../../../../reducers/ngl/constants';
import { setSortDialogOpen } from '../../molecule/redux/actions';
import { selectFirstMolecule } from '../../molecule/redux/dispatchActions';

export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, majorViewStage }) => (dispatch, getState) => {
dispatch(setObjectSelection([molGroupId]));
Expand Down
2 changes: 1 addition & 1 deletion js/components/session/downloadPdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const DownloadPdb = memo(({ targetOn, targetOnName, key }) => {
} else {
return (
<Button key={key} color="primary" onClick={handlePdbDownload} startIcon={<CloudDownload />}>
Download {targetOnName.toString()} structures
Download structures
</Button>
);
}
Expand Down

0 comments on commit 6b32900

Please sign in to comment.