diff --git a/app/ledger.js b/app/ledger.js index 985833e712..61d7197f7d 100644 --- a/app/ledger.js +++ b/app/ledger.js @@ -2003,7 +2003,7 @@ const showDisabledNotifications = () => { message: notificationTryPaymentsMessage, buttons: [ {text: locale.translation('noThanks')}, - {text: locale.translation('notificationTryPaymentsYes'), className: 'primary'} + {text: locale.translation('notificationTryPaymentsYes'), className: 'primaryButton'} ], options: { style: 'greetingStyle', @@ -2062,7 +2062,7 @@ const showNotificationAddFunds = () => { buttons: [ {text: locale.translation('turnOffNotifications')}, {text: locale.translation('updateLater')}, - {text: locale.translation('addFunds'), className: 'primary'} + {text: locale.translation('addFunds'), className: 'primaryButton'} ], options: { style: 'greetingStyle', @@ -2086,7 +2086,7 @@ const showNotificationReviewPublishers = (nextTime) => { buttons: [ {text: locale.translation('turnOffNotifications')}, {text: locale.translation('dismiss')}, - {text: locale.translation('reviewSites'), className: 'primary'} + {text: locale.translation('reviewSites'), className: 'primaryButton'} ], options: { style: 'greetingStyle', @@ -2107,7 +2107,7 @@ const showNotificationPaymentDone = (transactionContributionFiat) => { message: notificationPaymentDoneMessage, buttons: [ {text: locale.translation('turnOffNotifications')}, - {text: locale.translation('Ok'), className: 'primary'} + {text: locale.translation('Ok'), className: 'primaryButton'} ], options: { style: 'greetingStyle', diff --git a/app/renderer/components/preferences/payment/advancedSettings.js b/app/renderer/components/preferences/payment/advancedSettings.js index fb81cc9bf0..2b5ec7c2ff 100644 --- a/app/renderer/components/preferences/payment/advancedSettings.js +++ b/app/renderer/components/preferences/payment/advancedSettings.js @@ -90,11 +90,11 @@ class AdvancedSettingsFooter extends ImmutableComponent { render () { return
- +
@@ -156,7 +156,7 @@ class BitcoinDashboard extends ImmutableComponent {
-
} @@ -205,7 +205,7 @@ class BitcoinDashboard extends ImmutableComponent { @@ -299,7 +299,7 @@ class BitcoinDashboard extends ImmutableComponent { ?
- ) - } - - { - greeting - ? {greeting} - : null - } - {this.props.detail.get('message')} - - { - options.get('advancedText') && options.get('advancedLink') - ? {options.get('advancedText')} - : null - } - + return
+
+
+ { + greeting + ? {greeting} + : null + } + {this.props.detail.get('message')} + + { + options.get('advancedText') && options.get('advancedLink') + ? {options.get('advancedText')} + : null + } + +
+ + { + options.get('persist') + ? + { this.checkbox = node }} /> + + : null + } + { + this.props.detail.get('buttons').map((button) => + + ) + } + +
} } @@ -83,7 +90,7 @@ class NotificationBar extends ImmutableComponent { return null } - return
+ return
{ activeNotifications.takeLast(3).map((notificationDetail) => @@ -93,4 +100,34 @@ class NotificationBar extends ImmutableComponent { } } +const styles = StyleSheet.create({ + flexJustifyBetween: { + display: 'flex', + justifyContent: 'space-between', + flexFlow: 'row wrap' + }, + flexAlignCenter: { + display: 'flex', + alignItems: 'center' + }, + marginRight: { + marginRight: '6px' + }, + label: { + fontSize: '15px', + padding: '0 10px 0 0', + color: '#666' + }, + checkbox: { + marginRight: '3px' + }, + advanced: { + color: 'grey', + cursor: 'pointer', + textDecoration: 'underline', + fontSize: '13px', + margin: '5px' + } +}) + module.exports = NotificationBar diff --git a/js/components/updateBar.js b/js/components/updateBar.js index e3095bc11e..05a0f04906 100644 --- a/js/components/updateBar.js +++ b/js/components/updateBar.js @@ -13,6 +13,9 @@ const remote = require('electron').remote const path = require('path') const cx = require('../lib/classSet') +const {StyleSheet, css} = require('aphrodite/no-important') +const commonStyles = require('../../app/renderer/components/styles/commonStyles') + class UpdateHello extends ImmutableComponent { onSpinnerClick () { // To make testing of updates easier in dev mode, @@ -45,7 +48,7 @@ class UpdateHello extends ImmutableComponent { } render () { - return + return } @@ -70,7 +74,8 @@ class UpdateLog extends ImmutableComponent { remote.shell.openItem(path.join(remote.app.getPath('userData'), 'updateLog.log')) } render () { - return
} } class UpdateChecking extends ImmutableComponent { render () { - return
- + return
+
+ + +
+ - - -
} } class UpdateDownloading extends ImmutableComponent { render () { - return
- + return
+
+ + +
+ - - -
} } class UpdateError extends ImmutableComponent { render () { - return
- + return
+
+ + +
+ - - -
} } class UpdateNotAvailable extends ImmutableComponent { render () { - return
- + return
+
+ + +
+ - - -
} } @@ -182,7 +195,8 @@ class UpdateBar extends ImmutableComponent { updateStatus = UpdateStatus.UPDATE_AVAILABLE } - return
+ // 'notificationItem' for styling with notificationBar.less + return
{ updateStatus === UpdateStatus.UPDATE_AVAILABLE ? : null } @@ -202,4 +216,22 @@ class UpdateBar extends ImmutableComponent { } } +const styles = StyleSheet.create({ + flexJustifyBetween: { + display: 'flex', + justifyContent: 'space-between', + flexFlow: 'row wrap' + }, + flexAlignCenter: { + display: 'flex', + alignItems: 'center' + } +}) + +const updateBarStyle = css( + commonStyles.notificationBar, + commonStyles.notificationBar__notificationItem, + commonStyles.notificationBar__greetingStyle +) + module.exports = UpdateBar diff --git a/js/entry.js b/js/entry.js index 34fec11bb5..323e2e6a40 100644 --- a/js/entry.js +++ b/js/entry.js @@ -14,7 +14,6 @@ require('../less/switchControls.less') require('../less/tabs.less') require('../less/findbar.less') require('../less/dialogs.less') -require('../less/updateBar.less') require('../less/downloadBar.less') require('../less/bookmarksToolbar.less') require('../less/notificationBar.less') diff --git a/less/notificationBar.less b/less/notificationBar.less index e6a524eedd..3185fd9c76 100644 --- a/less/notificationBar.less +++ b/less/notificationBar.less @@ -3,108 +3,61 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ @import "variables.less"; -@import (reference) "button.less"; -.notificationBar { - display: inline-block; - width: 100%; - cursor: default; - -webkit-user-select: none; +// TODO: refactor notificationBar.js and updateBar.js +.notificationItem { - .notificationItem { - background-color: #ffefc0; - border-bottom: 1px solid #888; - line-height: 24px; - padding: 6px 12px 6px 20px; + // TODO: refactor button.less + .browserButton { + border: none; + box-shadow: none; + line-height: 1; - &.greetingStyle { - background-color: #fff; - padding: 8px 20px 6px 20px; - - .button { - .browserButton(); - - background-color: #eee; - border-style: none; - font-size: 14px; - height: 25px; - line-height: 27px; - margin: auto 0 auto 4px; - padding: 0px 25px; - width: auto; - - &.primary { - background-color: @braveOrange; - color: #fff; - margin-right: 0px; - - &:hover { - background-color: lighten(@braveOrange, 10%); - color: #fff !important; - } - &:active { - background-color: darken(@braveOrange, 10%); - color: #fff !important; - } - } - } - } - - label { - font-size: 15px; - padding: 0 10px 0 0; - color: #666; - } - - input[type="checkbox"] { - margin: 0 3px; + &:hover { + border: none; } - .button { - font-size: 13px; - margin-right: 10px; - padding: 2px 15px; - text-transform: capitalize; - width: auto; + &.whiteButton { + border: 1px solid @gray; } - .greeting { - color: @braveOrange; - font-size: 16px; - margin: auto 10px auto 0; - user-select: none; - } + &.primaryButton { + background: @braveOrange; + border: 1px solid @braveOrange; + box-shadow: none; + font-weight: normal; - .message { - color: #000; - font-size: 15px; - margin: auto 0; - user-select: none; - cursor: default; + &:hover { + background: lighten(@braveOrange, 10%); + border: 1px solid lighten(@braveOrange, 10%); + } - &.secondary { - color: #888; - font-size: 14px; - padding: 0; - margin: auto 0 auto 10px; + &:active { + background: darken(@braveOrange, 10%); + border: 1px solid darken(@braveOrange, 10%); } } + } - .options { - float: right; - margin-left: 6px; - } + // Copied to commonStyles.js - notificationItem__greetingStyle + // TODO: refactor app/ledger.js (style: 'greetingStyle') + &.greetingStyle { + background: #fff; + padding: 8px 20px; + width: 100%; + } +} - .spacer { - flex-grow: 1; - } +// TODO: remove +div[class*='notificationBar'] { + // Cancel the top margin of notificationBar (except the 1st one) + + div[class*='notificationBar'] { + margin-top: 0; + border-top: 0; - .notificationAdvanced { - color: grey; - cursor: pointer; - text-decoration: underline; - font-size: 13px; - margin: 5px; + // Cancel the top border of notificationItem (except the 1st one) + > div[class*='notificationItem'] { + border-top: 0; } } } diff --git a/less/tabs.less b/less/tabs.less index f0ce3b78cd..c8d2151a26 100644 --- a/less/tabs.less +++ b/less/tabs.less @@ -122,7 +122,7 @@ background: @tabsBackground; display: flex; height: @tabsToolbarHeight; - border-top: 1px solid #bbb; + border-top: 1px solid @tabsToolbarBorderColor; -webkit-user-select: none; } diff --git a/less/updateBar.less b/less/updateBar.less deleted file mode 100644 index 10ec46b097..0000000000 --- a/less/updateBar.less +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -@import "variables.less"; -@import (reference) "notificationBar.less"; - -.updateBar { - &:extend(.notificationBar.greetingStyle); - .notificationBar .notificationItem(); - .notificationBar .notificationItem.greetingStyle(); - - padding: 8px 16px 8px 20px; -} diff --git a/less/variables.less b/less/variables.less index 6180aac0ff..e5646ac135 100644 --- a/less/variables.less +++ b/less/variables.less @@ -22,6 +22,7 @@ @tabsBackground: #ddd; @tabsBackgroundInactive: #ddd; +@tabsToolbarBorderColor: #bbb; @navigationBarBackground: @chromeSecondary; @navigationBarBackground: #f7f7f7; @navigationBarBackgroundActive: #fff; diff --git a/test/bravery-components/notificationBarTest.js b/test/bravery-components/notificationBarTest.js index 8fb330d9f0..a4fdc32f03 100644 --- a/test/bravery-components/notificationBarTest.js +++ b/test/bravery-components/notificationBarTest.js @@ -40,7 +40,7 @@ describe('notificationBar permissions', function () { .loadUrl(this.notificationUrl) .windowByUrl(Brave.browserWindowUrl) .waitForExist(notificationBar) - .element('.notificationItem:nth-Child(1) .options') + .element('.notificationItem:nth-Child(1) [data-test-id="notificationOptions"]') .click('button=Deny') .activateTitleMode() .waitUntil(function () { diff --git a/test/lib/selectors.js b/test/lib/selectors.js index 73c914ddef..afd524f64b 100644 --- a/test/lib/selectors.js +++ b/test/lib/selectors.js @@ -22,7 +22,7 @@ module.exports = { navigatorBookmarked: '#navigator .removeBookmarkButton', navigatorNotBookmarked: '#navigator .bookmarkButton', bookmarksToolbar: '.bookmarksToolbar', - notificationBar: '.notificationBar', + notificationBar: '[data-test-id="notificationBar"]', errorContent: '.errorContent', errorUrl: '.errorUrl', errorText: '.errorText',