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

Commit 7e95e17

Browse files
gyandeepscezaraugusto
authored andcommitted
Update: SVG workand clean up on about pref page
auditor @bsclifton fixes #6931
1 parent 9aff02a commit 7e95e17

14 files changed

+346
-231
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
const ImmutableComponent = require('../../../../js/components/immutableComponent')
2+
const preferenceTabs = require('../../../../js/constants/preferenceTabs')
3+
const PreferenceNavigationButton = require('./preferenceNavigationButton')
4+
const HelpfulHints = require('./helpfulHints')
5+
6+
const {StyleSheet, css} = require('aphrodite')
7+
const globalStyles = require('../styles/global')
8+
9+
// Icons
10+
const iconGeneral = require('../../../extensions/brave/img/preferences/browser_prefs_general.svg')
11+
const iconSearch = require('../../../extensions/brave/img/preferences/browser_prefs_search.svg')
12+
const iconTabs = require('../../../extensions/brave/img/preferences/browser_prefs_tabs.svg')
13+
// const iconExtensions = require('../../../extensions/brave/img/preferences/browser_prefs_extensions.svg')
14+
const iconPlugins = require('../../../extensions/brave/img/preferences/browser_prefs_plugins.svg')
15+
const iconSecurity = require('../../../extensions/brave/img/preferences/browser_prefs_security.svg')
16+
const iconShields = require('../../../extensions/brave/img/preferences/browser_prefs_shields.svg')
17+
const iconPayments = require('../../../extensions/brave/img/preferences/browser_prefs_payments.svg')
18+
// sync TBD
19+
const iconSync = require('../../../extensions/brave/img/preferences/browser_prefs_sync.svg')
20+
const iconAdvanced = require('../../../extensions/brave/img/preferences/browser_prefs_advanced.svg')
21+
22+
class PreferenceNavigation extends ImmutableComponent {
23+
render () {
24+
return <div className={css(styles.prefAside)}>
25+
<div className={css(styles.prefNav)}>
26+
<PreferenceNavigationButton icon={styles.general}
27+
dataL10nId='general'
28+
onClick={this.props.changeTab.bind(null, preferenceTabs.GENERAL)}
29+
selected={this.props.preferenceTab === preferenceTabs.GENERAL}
30+
/>
31+
<PreferenceNavigationButton icon={styles.search}
32+
dataL10nId='search'
33+
onClick={this.props.changeTab.bind(null, preferenceTabs.SEARCH)}
34+
selected={this.props.preferenceTab === preferenceTabs.SEARCH}
35+
/>
36+
<PreferenceNavigationButton icon={styles.tabs}
37+
dataL10nId='tabs'
38+
onClick={this.props.changeTab.bind(null, preferenceTabs.TABS)}
39+
selected={this.props.preferenceTab === preferenceTabs.TABS}
40+
/>
41+
<PreferenceNavigationButton icon={styles.security}
42+
dataL10nId='security'
43+
onClick={this.props.changeTab.bind(null, preferenceTabs.SECURITY)}
44+
selected={this.props.preferenceTab === preferenceTabs.SECURITY}
45+
/>
46+
<PreferenceNavigationButton notImplemented icon={styles.sync}
47+
dataL10nId='sync'
48+
onClick={this.props.changeTab.bind(null, preferenceTabs.SYNC)}
49+
selected={this.props.preferenceTab === preferenceTabs.SYNC}
50+
/>
51+
<PreferenceNavigationButton icon={styles.payments}
52+
dataL10nId='payments'
53+
onClick={this.props.changeTab.bind(null, preferenceTabs.PAYMENTS)}
54+
selected={this.props.preferenceTab === preferenceTabs.PAYMENTS}
55+
/>
56+
{
57+
/* TODO @cezaraugusto add extensions panel */
58+
}
59+
<PreferenceNavigationButton icon={styles.plugins}
60+
dataL10nId='plugins'
61+
onClick={this.props.changeTab.bind(null, preferenceTabs.PLUGINS)}
62+
selected={this.props.preferenceTab === preferenceTabs.PLUGINS}
63+
/>
64+
<PreferenceNavigationButton icon={styles.shields}
65+
dataL10nId='shields'
66+
onClick={this.props.changeTab.bind(null, preferenceTabs.SHIELDS)}
67+
selected={this.props.preferenceTab === preferenceTabs.SHIELDS}
68+
/>
69+
<PreferenceNavigationButton icon={styles.advanced}
70+
dataL10nId='advanced'
71+
onClick={this.props.changeTab.bind(null, preferenceTabs.ADVANCED)}
72+
selected={this.props.preferenceTab === preferenceTabs.ADVANCED}
73+
/>
74+
</div>
75+
<HelpfulHints hintNumber={this.props.hintNumber} refreshHint={this.props.refreshHint} />
76+
</div>
77+
}
78+
}
79+
80+
const navIcon = icon => ({WebkitMask: `url(${icon}) no-repeat 0 0`})
81+
const styles = StyleSheet.create({
82+
prefAside: {
83+
background: `linear-gradient(${globalStyles.color.gray}, ${globalStyles.color.mediumGray})`,
84+
boxShadow: globalStyles.shadow.insetShadow,
85+
position: 'fixed',
86+
zIndex: '600',
87+
width: globalStyles.spacing.sideBarWidth,
88+
height: '100%',
89+
display: 'flex',
90+
flexFlow: 'column nowrap',
91+
fontSize: '16px'
92+
},
93+
94+
prefNav: {
95+
display: 'flex',
96+
flexFlow: 'column nowrap',
97+
flex: '1 0 auto',
98+
width: '100%',
99+
marginTop: '30px'
100+
},
101+
102+
general: navIcon(iconGeneral),
103+
search: navIcon(iconSearch),
104+
tabs: navIcon(iconTabs),
105+
plugins: navIcon(iconPlugins),
106+
security: navIcon(iconSecurity),
107+
shields: navIcon(iconShields),
108+
payments: navIcon(iconPayments),
109+
sync: navIcon(iconSync),
110+
advanced: navIcon(iconAdvanced)
111+
})
112+
113+
module.exports = PreferenceNavigation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
const ImmutableComponent = require('../../../../js/components/immutableComponent')
2+
const {StyleSheet, css} = require('aphrodite')
3+
const globalStyles = require('../styles/global')
4+
5+
class PreferenceNavigationButton extends ImmutableComponent {
6+
render () {
7+
return <div className={css(
8+
styles.prefNavItem,
9+
this.props.selected && styles.topBarButtonSelected,
10+
this.props.notImplemented && styles.notImplemented
11+
)}>
12+
<div onClick={this.props.onClick} className={css(styles.topBarButton)}>
13+
<div className={css(
14+
styles.icon,
15+
this.props.selected && styles.iconActive,
16+
this.props.icon)} />
17+
<div className={css(styles.text)} data-l10n-id={this.props.dataL10nId} />
18+
</div>
19+
</div>
20+
}
21+
}
22+
23+
const styles = StyleSheet.create({
24+
prefNavItem: {
25+
position: 'relative',
26+
display: 'block',
27+
width: '100%'
28+
},
29+
30+
notImplemented: {
31+
display: 'none'
32+
},
33+
34+
topBarButton: {
35+
position: 'relative',
36+
display: 'flex',
37+
alignItems: 'center',
38+
background: 'transparent',
39+
WebkitUserSelect: 'none',
40+
padding: '11px 11px 11px 17px',
41+
cursor: 'pointer',
42+
43+
':hover': {
44+
backgroundColor: globalStyles.color.darkGray
45+
}
46+
},
47+
48+
topBarButtonSelected: {
49+
backgroundColor: globalStyles.color.mediumGray,
50+
51+
':after': {
52+
content: '\'\'',
53+
borderWidth: '8px 8px 0',
54+
borderStyle: 'solid',
55+
borderColor: `${globalStyles.color.mediumGray} transparent transparent`,
56+
height: '0',
57+
left: 'calc(100% - 6px)',
58+
transform: 'rotateZ(-90deg)',
59+
position: 'absolute',
60+
width: '0',
61+
top: 'calc(50% - 4px)'
62+
},
63+
64+
':hover:after': {
65+
borderColor: `${globalStyles.color.darkGray} transparent transparent`
66+
}
67+
},
68+
69+
icon: {
70+
display: 'block',
71+
width: '1.4em',
72+
height: '1.4em',
73+
WebkitMaskSize: 'contain',
74+
marginRight: '9px',
75+
backgroundColor: '#ffffff'
76+
},
77+
78+
iconActive: {
79+
backgroundColor: '#ff5000'
80+
},
81+
82+
text: {
83+
color: '#ffffff'
84+
}
85+
})
86+
87+
module.exports = PreferenceNavigationButton

app/renderer/components/styles/global.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const globalStyles = {
117117
dialogShadow: '0px 8px 22px 0px rgba(0, 0, 0, .5)',
118118
softBoxShadow: '0 4px 8px lightGray',
119119
lightBoxShadow: '0 2px 2px lightGray',
120-
insetShadow: 'inset -5px 0 15px black25',
120+
insetShadow: 'inset -5px 0 15px rgba(0,0,0,0.25)',
121121
orangeButtonShadow: '0 2px 0 braveDarkOrange'
122122
},
123123
transition: {

0 commit comments

Comments
 (0)