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

Commit 9ad0f37

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

15 files changed

+347
-235
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

app/renderer/components/preferences/helpfulHints.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ const styles = StyleSheet.create({
4040
},
4141

4242
helpfulHints: {
43-
width: '100%',
44-
height: '100%',
4543
cursor: 'default',
46-
padding: '30px 0',
47-
marginTop: '20px'
44+
padding: '20px 0 0',
45+
overflowY: 'auto',
46+
47+
'@media (min-height: 620px)': {
48+
position: 'absolute',
49+
bottom: '0',
50+
overflowY: 'none'
51+
}
4852
},
4953

5054
hintsTitleContainer: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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 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+
padding: '30px 0'
99+
},
100+
101+
general: navIcon(iconGeneral),
102+
search: navIcon(iconSearch),
103+
tabs: navIcon(iconTabs),
104+
plugins: navIcon(iconPlugins),
105+
security: navIcon(iconSecurity),
106+
shields: navIcon(iconShields),
107+
payments: navIcon(iconPayments),
108+
sync: navIcon(iconSync),
109+
advanced: navIcon(iconAdvanced)
110+
})
111+
112+
module.exports = PreferenceNavigation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
flex: '1',
38+
alignItems: 'center',
39+
background: 'transparent',
40+
WebkitUserSelect: 'none',
41+
padding: '11px 11px 11px 17px',
42+
cursor: 'pointer',
43+
44+
':hover': {
45+
backgroundColor: globalStyles.color.darkGray
46+
}
47+
},
48+
49+
topBarButtonSelected: {
50+
backgroundColor: globalStyles.color.mediumGray,
51+
52+
':after': {
53+
content: '\'\'',
54+
borderWidth: '8px 8px 0',
55+
borderStyle: 'solid',
56+
borderColor: `${globalStyles.color.mediumGray} transparent transparent`,
57+
height: '0',
58+
left: 'calc(100% - 6px)',
59+
transform: 'rotateZ(-90deg)',
60+
position: 'absolute',
61+
width: '0',
62+
top: 'calc(50% - 4px)'
63+
},
64+
65+
':hover:after': {
66+
borderColor: `${globalStyles.color.darkGray} transparent transparent`
67+
}
68+
},
69+
70+
icon: {
71+
display: 'block',
72+
width: '1.4em',
73+
height: '1.4em',
74+
WebkitMaskSize: 'contain',
75+
marginRight: '9px',
76+
backgroundColor: '#ffffff'
77+
},
78+
79+
iconActive: {
80+
backgroundColor: '#ff5000'
81+
},
82+
83+
text: {
84+
color: '#ffffff'
85+
}
86+
})
87+
88+
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)