Skip to content

Commit 0c68327

Browse files
committed
Fixed-height Overlay for QuickAdd views
1 parent 740401d commit 0c68327

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

client/modules/App/components/Overlay.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ class Overlay extends React.Component {
6666
title,
6767
children,
6868
actions,
69+
isFixedHeight,
6970
} = this.props;
7071
return (
71-
<div className="overlay">
72+
<div className={`overlay ${isFixedHeight ? 'overlay--is-fixed-height' : ''}`}>
7273
<div className="overlay__content">
7374
<section
7475
role="main"
@@ -99,7 +100,8 @@ Overlay.propTypes = {
99100
closeOverlay: PropTypes.func,
100101
title: PropTypes.string,
101102
ariaLabel: PropTypes.string,
102-
previousPath: PropTypes.string
103+
previousPath: PropTypes.string,
104+
isFixedHeight: PropTypes.bool,
103105
};
104106

105107
Overlay.defaultProps = {
@@ -108,7 +110,8 @@ Overlay.defaultProps = {
108110
title: 'Modal',
109111
closeOverlay: null,
110112
ariaLabel: 'modal',
111-
previousPath: '/'
113+
previousPath: '/',
114+
isFixedHeight: false,
112115
};
113116

114117
export default Overlay;

client/modules/IDE/components/SketchList.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ class SketchList extends React.Component {
407407
{
408408
this.state.sketchToAddToCollection &&
409409
<Overlay
410+
isFixedHeight
410411
title="Add to collection"
411412
closeOverlay={() => this.setState({ sketchToAddToCollection: null })}
412413
>

client/modules/IDE/pages/IDEView.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ class IDEView extends React.Component {
383383
title="Add sketch to collection"
384384
previousPath={this.props.ide.previousPath}
385385
actions={<CollectionSearchbar />}
386+
isFixedHeight
386387
>
387388
<AddToCollectionList
388389
projectId={this.props.params.project_id}

client/modules/User/components/Collection.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { getCollection } from '../../IDE/selectors/collections';
1717
import Loader from '../../App/components/loader';
1818
import EditableInput from '../../IDE/components/EditableInput';
1919
import Overlay from '../../App/components/Overlay';
20-
import SketchList from '../../IDE/components/AddToCollectionSketchList';
20+
import AddToCollectionSketchList from '../../IDE/components/AddToCollectionSketchList';
2121
import CopyableInput from '../../IDE/components/CopyableInput';
2222
import { SketchSearchbar } from '../../IDE/components/Searchbar';
2323
import dropdownArrow from '../../../images/down-arrow.svg';
@@ -321,9 +321,9 @@ class Collection extends React.Component {
321321
}
322322
{
323323
this.state.isAddingSketches && (
324-
<Overlay title="Add sketches" actions={<SketchSearchbar />} closeOverlay={this.hideAddSketches}>
324+
<Overlay title="Add sketches" actions={<SketchSearchbar />} closeOverlay={this.hideAddSketches} isFixedHeight>
325325
<div className="collection-add-sketch">
326-
<SketchList username={this.props.username} collection={this.props.collection} />
326+
<AddToCollectionSketchList username={this.props.username} collection={this.props.collection} />
327327
</div>
328328
</Overlay>
329329
)

client/styles/components/_overlay.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,13 @@
4646
@include icon();
4747
padding: #{3 / $base-font-size}rem 0 #{3 / $base-font-size}rem #{10 / $base-font-size}rem;
4848
}
49+
50+
/* Fixed height overlay */
51+
.overlay--is-fixed-height .overlay__body {
52+
height: 80vh;
53+
}
54+
55+
.overlay--is-fixed-height .overlay__header {
56+
flex: 0;
57+
}
58+

0 commit comments

Comments
 (0)