This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 971
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: SVG workand clean up on about pref page
auditor @bsclifton fixes #6931
- Loading branch information
Showing
15 changed files
with
347 additions
and
235 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
app/extensions/brave/img/preferences/browser_prefs_advanced.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
app/extensions/brave/img/preferences/browser_prefs_extensions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
app/extensions/brave/img/preferences/browser_prefs_general.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
app/extensions/brave/img/preferences/browser_prefs_payments.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
app/extensions/brave/img/preferences/browser_prefs_search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
app/extensions/brave/img/preferences/browser_prefs_security.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions
36
app/extensions/brave/img/preferences/browser_prefs_shields.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
app/extensions/brave/img/preferences/browser_prefs_sync.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
app/renderer/components/preferences/preferenceNavigation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
const ImmutableComponent = require('../../../../js/components/immutableComponent') | ||
const preferenceTabs = require('../../../../js/constants/preferenceTabs') | ||
const PreferenceNavigationButton = require('./preferenceNavigationButton') | ||
const HelpfulHints = require('./helpfulHints') | ||
|
||
const {StyleSheet, css} = require('aphrodite') | ||
const globalStyles = require('../styles/global') | ||
|
||
// Icons | ||
const iconGeneral = require('../../../extensions/brave/img/preferences/browser_prefs_general.svg') | ||
const iconSearch = require('../../../extensions/brave/img/preferences/browser_prefs_search.svg') | ||
const iconTabs = require('../../../extensions/brave/img/preferences/browser_prefs_tabs.svg') | ||
// const iconExtensions = require('../../../extensions/brave/img/preferences/browser_prefs_extensions.svg') | ||
const iconPlugins = require('../../../extensions/brave/img/preferences/browser_prefs_plugins.svg') | ||
const iconSecurity = require('../../../extensions/brave/img/preferences/browser_prefs_security.svg') | ||
const iconShields = require('../../../extensions/brave/img/preferences/browser_prefs_shields.svg') | ||
const iconPayments = require('../../../extensions/brave/img/preferences/browser_prefs_payments.svg') | ||
// sync TBD | ||
const iconSync = require('../../../extensions/brave/img/preferences/browser_prefs_sync.svg') | ||
const iconAdvanced = require('../../../extensions/brave/img/preferences/browser_prefs_advanced.svg') | ||
|
||
class PreferenceNavigation extends ImmutableComponent { | ||
render () { | ||
return <div className={css(styles.prefAside)}> | ||
<div className={css(styles.prefNav)}> | ||
<PreferenceNavigationButton icon={styles.general} | ||
dataL10nId='general' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.GENERAL)} | ||
selected={this.props.preferenceTab === preferenceTabs.GENERAL} | ||
/> | ||
<PreferenceNavigationButton icon={styles.search} | ||
dataL10nId='search' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.SEARCH)} | ||
selected={this.props.preferenceTab === preferenceTabs.SEARCH} | ||
/> | ||
<PreferenceNavigationButton icon={styles.tabs} | ||
dataL10nId='tabs' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.TABS)} | ||
selected={this.props.preferenceTab === preferenceTabs.TABS} | ||
/> | ||
<PreferenceNavigationButton icon={styles.security} | ||
dataL10nId='security' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.SECURITY)} | ||
selected={this.props.preferenceTab === preferenceTabs.SECURITY} | ||
/> | ||
<PreferenceNavigationButton icon={styles.sync} | ||
dataL10nId='sync' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.SYNC)} | ||
selected={this.props.preferenceTab === preferenceTabs.SYNC} | ||
/> | ||
<PreferenceNavigationButton icon={styles.payments} | ||
dataL10nId='payments' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.PAYMENTS)} | ||
selected={this.props.preferenceTab === preferenceTabs.PAYMENTS} | ||
/> | ||
{ | ||
/* TODO @cezaraugusto add extensions panel */ | ||
} | ||
<PreferenceNavigationButton icon={styles.plugins} | ||
dataL10nId='plugins' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.PLUGINS)} | ||
selected={this.props.preferenceTab === preferenceTabs.PLUGINS} | ||
/> | ||
<PreferenceNavigationButton icon={styles.shields} | ||
dataL10nId='shields' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.SHIELDS)} | ||
selected={this.props.preferenceTab === preferenceTabs.SHIELDS} | ||
/> | ||
<PreferenceNavigationButton icon={styles.advanced} | ||
dataL10nId='advanced' | ||
onClick={this.props.changeTab.bind(null, preferenceTabs.ADVANCED)} | ||
selected={this.props.preferenceTab === preferenceTabs.ADVANCED} | ||
/> | ||
</div> | ||
<HelpfulHints hintNumber={this.props.hintNumber} refreshHint={this.props.refreshHint} /> | ||
</div> | ||
} | ||
} | ||
|
||
const navIcon = icon => ({WebkitMask: `url(${icon}) no-repeat 0 0`}) | ||
const styles = StyleSheet.create({ | ||
prefAside: { | ||
background: `linear-gradient(${globalStyles.color.gray}, ${globalStyles.color.mediumGray})`, | ||
boxShadow: globalStyles.shadow.insetShadow, | ||
position: 'fixed', | ||
zIndex: '600', | ||
width: globalStyles.spacing.sideBarWidth, | ||
height: '100%', | ||
display: 'flex', | ||
flexFlow: 'column nowrap', | ||
fontSize: '16px' | ||
}, | ||
|
||
prefNav: { | ||
display: 'flex', | ||
flexFlow: 'column nowrap', | ||
flex: '1 0 auto', | ||
padding: '30px 0' | ||
}, | ||
|
||
general: navIcon(iconGeneral), | ||
search: navIcon(iconSearch), | ||
tabs: navIcon(iconTabs), | ||
plugins: navIcon(iconPlugins), | ||
security: navIcon(iconSecurity), | ||
shields: navIcon(iconShields), | ||
payments: navIcon(iconPayments), | ||
sync: navIcon(iconSync), | ||
advanced: navIcon(iconAdvanced) | ||
}) | ||
|
||
module.exports = PreferenceNavigation |
88 changes: 88 additions & 0 deletions
88
app/renderer/components/preferences/preferenceNavigationButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
const ImmutableComponent = require('../../../../js/components/immutableComponent') | ||
const {StyleSheet, css} = require('aphrodite') | ||
const globalStyles = require('../styles/global') | ||
|
||
class PreferenceNavigationButton extends ImmutableComponent { | ||
render () { | ||
return <div className={css( | ||
styles.prefNavItem, | ||
this.props.selected && styles.topBarButtonSelected, | ||
this.props.notImplemented && styles.notImplemented | ||
)}> | ||
<div onClick={this.props.onClick} className={css(styles.topBarButton)}> | ||
<div className={css( | ||
styles.icon, | ||
this.props.selected && styles.iconActive, | ||
this.props.icon)} /> | ||
<div className={css(styles.text)} data-l10n-id={this.props.dataL10nId} /> | ||
</div> | ||
</div> | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
prefNavItem: { | ||
position: 'relative', | ||
display: 'block', | ||
width: '100%' | ||
}, | ||
|
||
notImplemented: { | ||
display: 'none' | ||
}, | ||
|
||
topBarButton: { | ||
position: 'relative', | ||
display: 'flex', | ||
flex: '1', | ||
alignItems: 'center', | ||
background: 'transparent', | ||
WebkitUserSelect: 'none', | ||
padding: '11px 11px 11px 17px', | ||
cursor: 'pointer', | ||
|
||
':hover': { | ||
backgroundColor: globalStyles.color.darkGray | ||
} | ||
}, | ||
|
||
topBarButtonSelected: { | ||
backgroundColor: globalStyles.color.mediumGray, | ||
|
||
':after': { | ||
content: '\'\'', | ||
borderWidth: '8px 8px 0', | ||
borderStyle: 'solid', | ||
borderColor: `${globalStyles.color.mediumGray} transparent transparent`, | ||
height: '0', | ||
left: 'calc(100% - 6px)', | ||
transform: 'rotateZ(-90deg)', | ||
position: 'absolute', | ||
width: '0', | ||
top: 'calc(50% - 4px)' | ||
}, | ||
|
||
':hover:after': { | ||
borderColor: `${globalStyles.color.darkGray} transparent transparent` | ||
} | ||
}, | ||
|
||
icon: { | ||
display: 'block', | ||
width: '1.4em', | ||
height: '1.4em', | ||
WebkitMaskSize: 'contain', | ||
marginRight: '9px', | ||
backgroundColor: '#ffffff' | ||
}, | ||
|
||
iconActive: { | ||
backgroundColor: '#ff5000' | ||
}, | ||
|
||
text: { | ||
color: '#ffffff' | ||
} | ||
}) | ||
|
||
module.exports = PreferenceNavigationButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.