From 75f3a18145b474c4538d7aa7cb7a915074c9b3ba Mon Sep 17 00:00:00 2001 From: Suguru Hirahara Date: Thu, 20 Jul 2017 00:51:58 +0900 Subject: [PATCH] Refactor navigationBar (part 2) Addresses #9283 Full changelog: https://github.com/brave/browser-laptop/commit/561ffbd17d9581e283587708ef7b7332f6792c6a https://github.com/brave/browser-laptop/commit/d82d8bcf919f0bebdb523e993c97a9fb9d808115 https://github.com/brave/browser-laptop/commit/3990ecba458dde443e35e7c9bca74eb12ea77b82 https://github.com/brave/browser-laptop/commit/c1b8416ef91b4714e5c645a7cc894e443469e7e7 https://github.com/brave/browser-laptop/commit/2d7d7fa476ee82ff98a9b563e4fb81a327a926a2 https://github.com/brave/browser-laptop/commit/7d711083bf1f3cad789a51636dc8d318f6ce5ffc https://github.com/brave/browser-laptop/commit/e7e96c81b0c9302270f0cbca0f93fdf9728876aa https://github.com/brave/browser-laptop/commit/fcb7989105a72db2f05d06bc61411b1b77f05470 --- .../components/common/browserButton.js | 25 ++- .../components/common/longPressButton.js | 34 +++- .../components/navigation/browserAction.js | 9 +- .../navigation/browserActionBadge.js | 12 +- .../navigation/buttons/bookmarkButton.js | 47 ++--- .../navigation/buttons/homeButton.js | 37 ++-- .../buttons/navigationBarButtonContainer.js | 45 +++-- .../navigation/buttons/reloadButton.js | 34 +--- .../navigation/buttons/stopButton.js | 55 ++---- .../components/navigation/navigationBar.js | 22 ++- .../components/navigation/navigator.js | 77 ++++---- .../components/navigation/publisherToggle.js | 59 ++---- app/renderer/components/navigation/urlBar.js | 170 +++++++++--------- .../components/navigation/urlBarIcon.js | 28 +-- .../app/renderer/components/messageBoxTest.js | 4 +- test/lib/selectors.js | 10 +- test/navbar-components/navigationBarTest.js | 88 ++++----- test/navbar-components/urlBarTest.js | 18 +- test/tab-components/frameTest.js | 20 +-- test/tab-components/tabTest.js | 2 +- .../navigation/navigationBarTest.js | 11 ++ .../components/navigation/navigatorTest.js | 6 +- .../navigation/publisherToggleTest.js | 6 +- 23 files changed, 407 insertions(+), 412 deletions(-) diff --git a/app/renderer/components/common/browserButton.js b/app/renderer/components/common/browserButton.js index ee6eb09d22d..8ba8519072e 100644 --- a/app/renderer/components/common/browserButton.js +++ b/app/renderer/components/common/browserButton.js @@ -88,7 +88,14 @@ class NormalizedButton extends ImmutableComponent { data-l10n-args={JSON.stringify(this.props.l10nArgs || {})} data-button-value={this.props.dataButtonValue} onClick={this.props.onClick} - className={css(styles.normalizedButton, this.props.custom)} + className={css( + styles.normalizedButton, + + // For homeButton, stopButton, and bookmarkButton + this.props.navigationButton && styles.normalizedButton_navigationButton, + + this.props.custom + )} // for publisherToggle.js data-test-authorized={this.props.testAuthorized} @@ -202,13 +209,12 @@ const styles = StyleSheet.create({ } }, + // This should be included in navigationBarButtonContainer browserButton_extensionItem: { - WebkitAppRegion: 'no-drag', backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', height: '17px', - margin: '4px 0 0 0', - opacity: '0.85', - backgroundRepeat: 'no-repeat' + opacity: '0.85' }, browserButton_groupedItem: { @@ -285,6 +291,15 @@ const styles = StyleSheet.create({ margin: 0, userSelect: 'none', whiteSpace: 'nowrap' + }, + + normalizedButton_navigationButton: { + display: 'inline-block', + width: '100%', + height: '100%', + + // cf: https://github.com/brave/browser-laptop/blob/b161b37cf5e9f59be64855ebbc5d04816bfc537b/less/navigationBar.less#L585 + padding: 0 } }) diff --git a/app/renderer/components/common/longPressButton.js b/app/renderer/components/common/longPressButton.js index 3b3d3df1a2f..710244b6ab3 100644 --- a/app/renderer/components/common/longPressButton.js +++ b/app/renderer/components/common/longPressButton.js @@ -4,6 +4,8 @@ const React = require('react') const ImmutableComponent = require('../immutableComponent') +const cx = require('../../../../js/lib/classSet') +const {StyleSheet, css} = require('aphrodite/no-important') class LongPressButton extends ImmutableComponent { constructor () { @@ -78,16 +80,42 @@ class LongPressButton extends ImmutableComponent { } render () { - return