Skip to content

Commit

Permalink
Fix vertical spacing for navbar item combinations
Browse files Browse the repository at this point in the history
Fix brave#9370 by using collapsible margin so that items without border+padding can be evenly spaced (caption buttons, bookmark, tab pages), and those with border+padding (notifications, tabs) can be touching. Removes empty element for tab pages when there is only a single page, as it had no functional purpose. Instead, margin is used.
  • Loading branch information
petemill committed Aug 23, 2017
1 parent 12cd539 commit e7c03ae
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 22 deletions.
5 changes: 3 additions & 2 deletions app/renderer/components/bookmarks/bookmarksToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,14 @@ const styles = StyleSheet.create({
boxSizing: 'border-box',
display: 'flex',
flex: 1,
padding: `${globalStyles.spacing.navbarMenubarMargin} ${globalStyles.spacing.bookmarksToolbarPadding}`
padding: `0 ${globalStyles.spacing.bookmarksToolbarPadding}`,
margin: `${globalStyles.spacing.navbarMenubarMargin} 0`
},
bookmarksToolbar__allowDragging: {
WebkitAppRegion: 'drag'
},
bookmarksToolbar__showOnlyFavicon: {
padding: `${globalStyles.spacing.navbarMenubarMargin} 0 ${globalStyles.spacing.tabPagesHeight} ${globalStyles.spacing.bookmarksToolbarPadding}`
padding: `0 0 0 ${globalStyles.spacing.bookmarksToolbarPadding}`
},
bookmarksToolbar__bookmarkButton: {
boxSizing: 'border-box',
Expand Down
34 changes: 21 additions & 13 deletions app/renderer/components/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,11 @@ class Main extends React.Component {
? <PopupWindow />
: null
}
<div className='top'
<div className={cx({
top: true,
allowDragging: this.props.shouldAllowWindowDrag,
})
}
onMouseEnter={windowActions.setMouseInTitlebar.bind(null, true)}
onMouseLeave={windowActions.setMouseInTitlebar.bind(null, false)}
>
Expand Down Expand Up @@ -690,18 +694,22 @@ class Main extends React.Component {
? <BookmarksToolbar />
: null
}
<div className={cx({
tabPages: true,
allowDragging: this.props.shouldAllowWindowDrag,
singlePage: this.props.isSinglePage
})}
onContextMenu={this.onTabContextMenu}>
{
this.props.showTabPages
? <TabPages />
: null
}
</div>
{
this.props.isSinglePage
? null
: <div className={cx({
tabPages: true,
allowDragging: this.props.shouldAllowWindowDrag,
singlePage: this.props.isSinglePage
})}
onContextMenu={this.onTabContextMenu}>
{
this.props.showTabPages
? <TabPages />
: null
}
</div>
}
<TabsToolbar key='tab-bar' />
{
this.props.showNotificationBar
Expand Down
1 change: 1 addition & 0 deletions app/renderer/components/styles/commonStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const styles = StyleSheet.create({

// notificationBar
notificationBar: {
'-webkit-app-region': 'no-drag',
display: 'inline-block',
boxSizing: 'border-box',
width: '100%',
Expand Down
2 changes: 1 addition & 1 deletion less/navigationBar.less
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
// Styles had to be reworked to properly position the new caption buttons for Windows
.navbarCaptionButtonContainer {
display: flex;
//border-bottom: 1px solid #bbb;
margin-bottom: @navbarMenubarMargin;

&.allowDragging {
-webkit-app-region: drag;
Expand Down
7 changes: 1 addition & 6 deletions less/tabs.less
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
display: flex;
justify-content: center;
height: @tabPagesHeight;
padding: @tabPagesHeight 0 @navbarMenubarMargin 0;
margin: @navbarMenubarMargin 0 @navbarMenubarMargin 0;
position: relative;
z-index: @zindexTabs;

Expand All @@ -154,11 +154,6 @@
}
}

&.singlePage {
margin: 0;
padding: 0;
}

>div {
display: flex
}
Expand Down
3 changes: 3 additions & 0 deletions less/window.less
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ html,

.top {
background: linear-gradient(to bottom, #eaeaea, #f2f2f4);
&.allowDragging {
-webkit-app-region: drag;
}
}

.mainContainer {
Expand Down

0 comments on commit e7c03ae

Please sign in to comment.