Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit 6ebd52f

Browse files
author
Suguru Hirahara
committed
Misc change
- Convert 'buttonSeparator' Full changelog: 25f02d4 Test Plan: available on #9299 (comment)
1 parent 912d067 commit 6ebd52f

15 files changed

+118
-96
lines changed

app/renderer/components/bookmarks/addEditBookmarkHanger.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,20 @@ class AddEditBookmarkHanger extends React.Component {
159159
}
160160
}
161161

162+
const navigationButtonContainerWidth = globalStyles.navigationBar.navigationButtonContainer.width
163+
const navigationButtonContainerMarginRight = globalStyles.navigationBar.navigationButtonContainer.marginRight
164+
const bookmarkButtonContainerWidth = globalStyles.navigationBar.urlbarForm.height
165+
166+
// Add navigationButtonContainerMarginRight (6px)
167+
const navigationButtonWidth = `calc(${navigationButtonContainerWidth} + ${navigationButtonContainerMarginRight})`
168+
169+
// Count the reload and stop button, adding the half width of the bookmark button container
170+
// 12px == arrowUp width
171+
const bookmarkHangerPosition = `calc(12px + ${navigationButtonWidth} + (${bookmarkButtonContainerWidth} / 2))`
172+
173+
// Add another container width
174+
const bookmarkHangerPositionWithHomeButton = `calc(${bookmarkHangerPosition} + ${navigationButtonWidth})`
175+
162176
const styles = StyleSheet.create({
163177
// Copied from commonForm.js
164178
commonFormSection: {
@@ -185,7 +199,7 @@ const styles = StyleSheet.create({
185199
},
186200
bookmarkHanger__arrowUp: {
187201
position: 'relative',
188-
left: '54px',
202+
left: bookmarkHangerPosition,
189203

190204
'::after': {
191205
content: '""',
@@ -199,7 +213,7 @@ const styles = StyleSheet.create({
199213
}
200214
},
201215
bookmarkHanger__withHomeButton: {
202-
left: '83px'
216+
left: bookmarkHangerPositionWithHomeButton
203217
},
204218
bookmark__bottomWrapper: {
205219
display: 'flex',

app/renderer/components/common/commonForm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const styles = StyleSheet.create({
164164
maxWidth: globalStyles.spacing.bookmarkHangerMaxWidth,
165165
height: 'initial', // #8634
166166

167-
// Cancel the inherited value from .navbarMenubarFlexContainer, which is 'nowrap'.
167+
// Cancel the inherited value from navigator__menuBarAndNavigationBar on navigator.js, which is 'nowrap'.
168168
whiteSpace: 'normal'
169169
},
170170

app/renderer/components/navigation/navigationBar.js

+23-30
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class NavigationBar extends React.Component {
8888
this.props.bookmarked
8989
}
9090

91-
// BEM Level: navigator__navigationButtonContainer
91+
// BEM Level: navigationBar__navigationButtonContainer
9292
get stopButton () {
9393
return <button className={cx({
9494
normalizeButton: true,
@@ -99,7 +99,7 @@ class NavigationBar extends React.Component {
9999
/>
100100
}
101101

102-
// BEM Level: navigator__navigationButtonContainer
102+
// BEM Level: navigationBar__navigationButtonContainer
103103
get reloadButton () {
104104
return <LongPressButton className={cx({
105105
normalizeButton: true,
@@ -112,17 +112,17 @@ class NavigationBar extends React.Component {
112112
/>
113113
}
114114

115-
// BEM Level: navigator
115+
// BEM Level: navigationBar
116116
get bookmarkButtonContainer () {
117117
return <span className={css(
118-
commonStyles.navigator__buttonContainer,
119-
commonStyles.navigator__buttonContainer_outsideOfURLbar,
120-
styles.navigator__buttonContainer_bookmarkButtonContainer
118+
commonStyles.navigationBar__buttonContainer,
119+
commonStyles.navigationBar__buttonContainer_outsideOfURLbar,
120+
styles.navigationBar__buttonContainer_bookmarkButtonContainer
121121
)}>
122122
<button className={cx({
123123
normalizeButton: true,
124124
withHomeButton: getSetting(settings.SHOW_HOME_BUTTON),
125-
[css(styles.navigator__buttonContainer_bookmarkButtonContainer__bookmarkButton, this.bookmarked && styles.navigator__buttonContainer_bookmarkButtonContainer__bookmarkButton_removeBookmarkButton)]: true
125+
[css(styles.navigationBar__buttonContainer_bookmarkButtonContainer__bookmarkButton, this.bookmarked && styles.navigationBar__buttonContainer_bookmarkButtonContainer__bookmarkButton_removeBookmarkButton)]: true
126126
})}
127127
data-l10n-id={this.bookmarked ? 'removeBookmarkButton' : 'addBookmarkButton'}
128128
data-test-id={this.bookmarked ? 'bookmarked' : 'notBookmarked'}
@@ -193,12 +193,12 @@ class NavigationBar extends React.Component {
193193
return null
194194
}
195195

196-
return <div
197-
id='navigator'
196+
return <div id='navigationBar'
197+
data-test-id='navigationBar'
198198
data-frame-key={this.props.activeFrameKey}
199199
className={cx({
200200
titleMode: this.props.titleMode,
201-
[css(styles.navigator, (this.props.isDarwin && this.props.isFullScreen) && styles.navigator_isDarwin_isFullScreen, this.props.titleMode && styles.navigator_titleMode, this.props.isWideUrlBarEnabled && styles.navigator_wide)]: true
201+
[css(styles.navigationBar, (this.props.isDarwin && this.props.isFullScreen) && styles.navigationBar_isDarwin_isFullScreen, this.props.titleMode && styles.navigationBar_titleMode, this.props.isWideUrlBarEnabled && styles.navigationBar_wide)]: true
202202
})}>
203203
{
204204
this.props.showBookmarkHanger
@@ -210,7 +210,7 @@ class NavigationBar extends React.Component {
210210
? null
211211
: <span className={css(
212212
commonStyles.navigationButtonContainer,
213-
styles.navigator__navigationButtonContainer,
213+
styles.navigationBar__navigationButtonContainer,
214214
)}>
215215
{
216216
this.props.isLoading
@@ -223,7 +223,7 @@ class NavigationBar extends React.Component {
223223
this.props.showHomeButton
224224
? <span className={css(
225225
commonStyles.navigationButtonContainer,
226-
styles.navigator__navigationButtonContainer,
226+
styles.navigationBar__navigationButtonContainer,
227227
)}>
228228
<HomeButton activeTabId={this.props.activeTabId} />
229229
</span>
@@ -237,12 +237,7 @@ class NavigationBar extends React.Component {
237237
<UrlBar titleMode={this.props.titleMode} />
238238
{
239239
this.props.showPublisherToggle
240-
? <div className={css(
241-
this.props.titleMode && styles.navigator__endButtons_titleMode,
242-
!this.props.titleMode && styles.navigator__endButtons_notTitleMode
243-
)}>
244-
<PublisherToggle />
245-
</div>
240+
? <PublisherToggle />
246241
: null
247242
}
248243
</div>
@@ -253,14 +248,14 @@ const rightMargin = `calc(${globalStyles.spacing.navbarLeftMarginDarwin} / 2)`
253248

254249
const styles = StyleSheet.create({
255250

256-
navigator: {
251+
navigationBar: {
257252
boxSizing: 'border-box',
258253
display: 'flex',
259254
flexGrow: 1,
260255
alignItems: 'center',
261256
justifyContent: 'center',
262257
fontSize: '20px',
263-
minWidth: '0%', // allow the navigator to shrink
258+
minWidth: '0%', // allow the navigationBar to shrink
264259
maxWidth: '900px',
265260
marginRight: rightMargin,
266261
padding: 0,
@@ -269,24 +264,22 @@ const styles = StyleSheet.create({
269264
zIndex: globalStyles.zindex.zindexNavigationBar
270265
},
271266

272-
navigator_isDarwin_isFullScreen: {
267+
navigationBar_isDarwin_isFullScreen: {
273268
marginRight: 0
274269
},
275270

276-
navigator_titleMode: {
271+
navigationBar_titleMode: {
277272
animation: 'fadeIn 1.2s'
278273
},
279274

280-
navigator_wide: {
275+
navigationBar_wide: {
281276
maxWidth: '100%',
282277
marginRight: '0',
283278
justifyContent: 'initial'
284279
},
285280

286-
// cf: topLevelStartButtonContainer on navigator.js
287-
navigator__navigationButtonContainer: {
288-
// globalStyles.navigationBar.urlbarForm.height + 2px
289-
width: '27px'
281+
navigationBar__navigationButtonContainer: {
282+
width: globalStyles.navigationBar.navigationButtonContainer.width
290283
},
291284

292285
navigationButton: {
@@ -312,20 +305,20 @@ const styles = StyleSheet.create({
312305
},
313306

314307
// cf: navigator__buttonContainer_addPublisherButtonContainer on publisherToggle.js
315-
navigator__buttonContainer_bookmarkButtonContainer: {
308+
navigationBar__buttonContainer_bookmarkButtonContainer: {
316309
borderRight: 'none',
317310
borderTopRightRadius: 0,
318311
borderBottomRightRadius: 0
319312
},
320313

321-
navigator__buttonContainer_bookmarkButtonContainer__bookmarkButton: {
314+
navigationBar__buttonContainer_bookmarkButtonContainer__bookmarkButton: {
322315
background: `url(${bookmarkButton}) center no-repeat`,
323316
backgroundSize: '14px 14px',
324317
width: '100%',
325318
height: '100%'
326319
},
327320

328-
navigator__buttonContainer_bookmarkButtonContainer__bookmarkButton_removeBookmarkButton: {
321+
navigationBar__buttonContainer_bookmarkButtonContainer__bookmarkButton_removeBookmarkButton: {
329322
background: `url(${bookmarkedButton}) center no-repeat`
330323
}
331324
})

0 commit comments

Comments
 (0)