Skip to content

Commit 6734e8a

Browse files
SkylerBaekGerrit Code Review
authored andcommitted
Merge "[Enact Browser] Fix the end of pages gets cut when bookmarkbar is shown"
2 parents 33cbe5b + 0abb07e commit 6734e8a

7 files changed

Lines changed: 34 additions & 11 deletions

File tree

samples/enact-based/src/views/BookmarkManager/BookmarkManager.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import $L from '@enact/i18n/$L';
1515
import Button from '@enact/moonstone/Button';
1616
import {connect} from 'react-redux';
1717
import Notification from '@enact/moonstone/Notification';
18+
import classNames from 'classnames';
1819
import PropTypes from 'prop-types';
1920
import React, {Component} from 'react';
2021
import Scroller from '@enact/moonstone/Scroller';
@@ -27,6 +28,7 @@ import css from './BookmarkManager.module.less';
2728
class BookmarkManagerBase extends Component {
2829

2930
static propTypes = {
31+
alwaysShowBookmarks: PropTypes.bool,
3032
browser: PropTypes.object,
3133
data: PropTypes.array,
3234
selectedIndices: PropTypes.array,
@@ -85,7 +87,10 @@ class BookmarkManagerBase extends Component {
8587
}
8688

8789
render () {
88-
const {browser, data, hasSelection, ...rest} = this.props;
90+
const
91+
{alwaysShowBookmarks, browser, data, hasSelection, ...rest} = this.props,
92+
scrollerClass = classNames(css.scroller, {[css.shrinkHeight]: alwaysShowBookmarks});
93+
8994
delete rest.selectedIndices;
9095
delete rest.selectAllBookmarks;
9196
delete rest.deselectAllBookmarks;
@@ -114,7 +119,7 @@ class BookmarkManagerBase extends Component {
114119
</Notification>
115120
{
116121
(data.length > 0) ?
117-
<Scroller horizontalScrollbar="hidden" className={css.list}>
122+
<Scroller horizontalScrollbar="hidden" className={scrollerClass}>
118123
<BookmarkList browser={browser}/>
119124
</Scroller>
120125
:

samples/enact-based/src/views/BookmarkManager/BookmarkManager.module.less

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222
});
2323
}
2424

25-
.list {
25+
.scroller {
2626
height: ~"calc(100vh - " 200px + @moon-button-height + 36px ~")";
2727
padding: 20px 10px 10px 10px;
28+
&.shrinkHeight {
29+
// shirnk as much as bookmarkbar height (84px)
30+
height: ~"calc(100vh - " 200px + @moon-button-height + 36px + 84px ~")";
31+
}
2832
}
2933

3034
.noItem {

samples/enact-based/src/views/ContentView/ContentItem.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ const ContentItem = kind({
7474
case TabTypes.SITE_FILTERING:
7575
return <SiteFiltering style={style} browser={browser} />;
7676
case TabTypes.BOOKMARKS:
77-
return <BookmarkManager style={style} browser={browser} />;
77+
return <BookmarkManager style={style} alwaysShowBookmarks={alwaysShowBookmarks} browser={browser} />;
7878
case TabTypes.HISTORY:
79-
return <History style={style} browser={browser} isSelectedTab={isSelectedTab} />;
79+
return <History style={style} alwaysShowBookmarks={alwaysShowBookmarks} browser={browser} isSelectedTab={isSelectedTab} />;
8080
}
8181
}
8282
});
8383

8484
export default ContentItem;
85-
export {ContentItem};
85+
export {ContentItem};

samples/enact-based/src/views/History/History.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import $L from '@enact/i18n/$L';
1515
import Button from '@enact/moonstone/Button';
1616
import {connect} from 'react-redux';
1717
import Notification from '@enact/moonstone/Notification';
18+
import classNames from 'classnames';
1819
import PropTypes from 'prop-types';
1920
import React, {Component} from 'react';
2021
import ri from '@enact/ui/resolution';
@@ -29,6 +30,7 @@ import css from './History.module.less';
2930
class HistoryBase extends Component {
3031

3132
static propTypes = {
33+
alwaysShowBookmarks: PropTypes.bool,
3234
browser: PropTypes.object,
3335
data: PropTypes.array,
3436
deselectAllHistory: PropTypes.func,
@@ -159,7 +161,10 @@ class HistoryBase extends Component {
159161
}
160162

161163
render () {
162-
const {data, hasSelection, ...rest} = this.props;
164+
const
165+
{alwaysShowBookmarks, data, hasSelection, ...rest} = this.props,
166+
listClass = classNames(css.list, {[css.shrinkHeight]:alwaysShowBookmarks});
167+
163168

164169
delete rest.browser;
165170
delete rest.deselectAllHistory;
@@ -195,7 +200,7 @@ class HistoryBase extends Component {
195200
dataSize={this.viewData.length}
196201
focusableScrollbar
197202
itemRenderer={this.renderItem}
198-
className={css.list}
203+
className={listClass}
199204
itemSize={ri.scale(70)}
200205
/>
201206
: <div>{$L('There is no history.')}</div>

samples/enact-based/src/views/History/History.module.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
height: ~"calc(100vh - " 200px + @moon-button-height + 36px ~")";
2727
padding: 10px;
2828
margin-top: 20px;
29+
&.shrinkHeight {
30+
// shirnk as much as bookmarkbar height (84px)
31+
height: ~"calc(100vh - " 200px + @moon-button-height + 36px + 84px ~")";
32+
}
2933
}

samples/enact-based/src/views/Settings/Settings.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,17 @@ class SettingsBase extends Component {
163163
privateBrowsing,
164164
...rest
165165
} = this.props,
166-
classes = classNames(className, css.settings),
166+
scrollerClass = classNames(css.scroller, {[css.shrinkHeight]: alwaysShowBookmarks}),
167+
settingContentsClass= classNames(className, css.settings),
167168
startupOption = startupOptions.indexOf(startupPage);
168169

169170
delete rest.browser;
170171
delete rest.dispatch;
171172
delete rest.homePageUrl;
172173

173174
return (
174-
<Scroller {...rest} className={css.scroller}>
175-
<div className={classes}>
175+
<Scroller {...rest} className={scrollerClass}>
176+
<div className={settingContentsClass}>
176177
<BodyText>{$L('On Startup')}</BodyText>
177178
<div className={css.indent}>
178179
<Group

samples/enact-based/src/views/Settings/Settings.module.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
.scroller {
66
height: ~"calc(100vh - " 236px ~")";
7+
&.shrinkHeight {
8+
// shirnk as much as bookmarkbar height (84px)
9+
height: ~"calc(100vh - " 238px + 84px ~")";
10+
}
711
}
812

913
.settings {

0 commit comments

Comments
 (0)