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

Commit

Permalink
Subtle animate extensions/braveMenu badges
Browse files Browse the repository at this point in the history
Close #8186
Auditors:
Test Plan:
  • Loading branch information
cezaraugusto committed May 23, 2017
1 parent 87e7340 commit 8ccad08
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
13 changes: 9 additions & 4 deletions app/renderer/components/navigation/browserActionBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const React = require('react')
const {StyleSheet, css} = require('aphrodite')
const ImmutableComponent = require('../immutableComponent')
const commonStyles = require('../styles/global')
const globalStyles = require('../styles/global')

class BrowserActionBadge extends ImmutableComponent {
constructor () {
Expand All @@ -30,9 +30,13 @@ class BrowserActionBadge extends ImmutableComponent {
ref='badge'
className={css(
styles.browserActionBadge,
this.centered && styles.centered
this.centered && styles.centered,
// delay badge show-up.
// this is also set for braveryPanel badge
// in a way that both can appear at the same time.
styles.subtleShowUp
)}
style={{backgroundColor: this.props.color || commonStyles.color.braveMediumOrange}}
style={{backgroundColor: this.props.color || globalStyles.color.braveMediumOrange}}
>{this.props.text}</div>
}
}
Expand All @@ -58,7 +62,8 @@ const styles = StyleSheet.create({
maxWidth: 'calc(100% - 5px)',
overflow: 'hidden',
textOverflow: 'ellipsis'
}
},
subtleShowUp: globalStyles.animations.subtleShowUp
})

module.exports = BrowserActionBadge
12 changes: 10 additions & 2 deletions app/renderer/components/navigation/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const React = require('react')
const {StyleSheet, css} = require('aphrodite')
const electron = require('electron')
const ipc = electron.ipcRenderer
const Immutable = require('immutable')
Expand Down Expand Up @@ -44,6 +43,10 @@ const messages = require('../../../../js/constants/messages')
const appConfig = require('../../../../js/constants/appConfig')
const settings = require('../../../../js/constants/settings')

// Styles
const {StyleSheet, css} = require('aphrodite')
const globalStyles = require('../styles/global')

class Navigator extends React.Component {
constructor () {
super()
Expand Down Expand Up @@ -285,7 +288,11 @@ class Navigator extends React.Component {
this.props.isCounterEnabled
? <div className={css(
styles.lionBadge,
(this.props.menuBarVisible || !isWindows()) && styles.lionBadgeRight
(this.props.menuBarVisible || !isWindows()) && styles.lionBadgeRight,
// delay badge show-up.
// this is also set for extension badge
// in a way that both can appear at the same time.
styles.subtleShowUp
)}
data-test-id='lionBadge'>
{this.props.totalBlocks}
Expand Down Expand Up @@ -335,6 +342,7 @@ const styles = StyleSheet.create({
braveMenuContainer: {
position: 'relative'
},
subtleShowUp: globalStyles.animations.subtleShowUp,

// TODO: Refactor navigator.js with Aphrodite to remove !important
navigatorWrapper__topLevelEndButtons_isWideURLbarEnabled: {
Expand Down
12 changes: 11 additions & 1 deletion app/renderer/components/styles/animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ const spinKeyframes = {
}
}

const opacityIncreaseKeyframes = {
'from': {
opacity: 0
},
'to': {
opacity: 1
}
}

module.exports = {
spinKeyframes
spinKeyframes,
opacityIncreaseKeyframes
}
12 changes: 12 additions & 0 deletions app/renderer/components/styles/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* 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/. */

const {opacityIncreaseKeyframes} = require('./animations')

/**
* Historically this file includes styles with no defined criteria.
* Imagine this file as a future reference for theming, in a way
Expand Down Expand Up @@ -240,6 +242,16 @@ const globalStyles = {
moreInfo: 'fa fa-info-circle',
angleDoubleRight: 'fa fa-angle-double-right'
},
animations: {
subtleShowUp: {
opacity: 0,
animationName: opacityIncreaseKeyframes,
animationDelay: '120ms',
animationTimingFunction: 'linear',
animationDuration: '120ms',
animationFillMode: 'forwards'
}
},
button: {
default: {
color: '#5a5a5a',
Expand Down

0 comments on commit 8ccad08

Please sign in to comment.