3
3
* You can obtain one at http://mozilla.org/MPL/2.0/. */
4
4
5
5
import * as React from 'react'
6
- import { Grid , Column , SwitchButton , BrowserSelect , ContentToggle } from 'brave-ui'
6
+ import { Grid , Column } from 'brave-ui/gridSystem'
7
+ import SwitchButton from 'brave-ui/switchButton'
8
+ import SelectOption from 'brave-ui/selectOption'
9
+ import ContentToggleArrow from 'brave-ui/contentToggleArrow'
10
+ import BoxedContent from 'brave-ui/boxedContent'
7
11
import * as shieldActions from '../../types/actions/shieldsPanelActions'
8
12
import { BlockOptions , BlockFPOptions , BlockCookiesOptions } from '../../types/other/blockTypes'
9
13
import { getMessage } from '../../background/api/localeAPI'
10
14
import { NoScriptInfo } from '../../types/other/noScriptInfo'
11
15
import NoScript from '../noScript/noScript'
16
+ import theme from '../../theme'
12
17
13
- export interface Props {
18
+ export interface BraveShieldsControlsProps {
14
19
controlsOpen : boolean
15
20
braveShields : BlockOptions
16
21
httpUpgradableResources : BlockOptions
@@ -30,8 +35,8 @@ export interface Props {
30
35
changeNoScriptSettings : shieldActions . ChangeNoScriptSettings
31
36
}
32
37
33
- export default class BraveShieldsControls extends React . Component < Props , Object > {
34
- constructor ( props : Props ) {
38
+ export default class BraveShieldsControls extends React . Component < BraveShieldsControlsProps , { } > {
39
+ constructor ( props : BraveShieldsControlsProps ) {
35
40
super ( props )
36
41
this . onChangeAdControl = this . onChangeAdControl . bind ( this )
37
42
this . onToggleControls = this . onToggleControls . bind ( this )
@@ -78,92 +83,91 @@ export default class BraveShieldsControls extends React.Component<Props, Object>
78
83
render ( ) {
79
84
const { braveShields, ads, trackers, controlsOpen, httpUpgradableResources, javascript, fingerprinting, cookies, noScriptInfo } = this . props
80
85
return (
81
- < Grid
82
- id = 'braveShieldsControls'
83
- background = '#eee'
84
- padding = '10px 10px 0'
85
- gap = '10px 5px'
86
- >
86
+ < Grid id = 'braveShieldsControls' theme = { theme . braveShieldsControls } >
87
87
< Column >
88
- < ContentToggle
88
+ < ContentToggleArrow
89
+ id = 'advancedControlsToggle'
89
90
withSeparator = { true }
90
91
open = { controlsOpen }
91
92
summary = { getMessage ( 'shieldsControlsAdvancedControls' ) }
92
93
onClick = { this . onToggleControls }
93
94
>
94
- < BrowserSelect
95
- disabled = { braveShields === 'block' }
96
- titleName = { getMessage ( 'shieldsControlsAdControl' ) }
97
- value = { braveShields !== 'block' && ads !== 'allow' && trackers !== 'allow' ? 'allow' : 'block' }
98
- onChange = { this . onChangeAdControl }
99
- >
100
- { /* TODO needs "show brave ads" */ }
101
- < option value = 'allow' > { getMessage ( 'shieldsControlsAdControlOptionBlockAds' ) } </ option >
102
- < option value = 'block' > { getMessage ( 'shieldsControlsAdControlOptionAllowAdsTracking' ) } </ option >
103
- </ BrowserSelect >
95
+ < BoxedContent theme = { theme . braveShieldsControlsContent } >
96
+ < SelectOption
97
+ id = 'shieldsControlsAdControl'
98
+ disabled = { braveShields === 'block' }
99
+ titleName = { getMessage ( 'shieldsControlsAdControl' ) }
100
+ value = { braveShields !== 'block' && ads !== 'allow' && trackers !== 'allow' ? 'allow' : 'block' }
101
+ onChange = { this . onChangeAdControl }
102
+ >
103
+ { /* TODO needs "show brave ads" */ }
104
+ < option value = 'allow' > { getMessage ( 'shieldsControlsAdControlOptionBlockAds' ) } </ option >
105
+ < option value = 'block' > { getMessage ( 'shieldsControlsAdControlOptionAllowAdsTracking' ) } </ option >
106
+ </ SelectOption >
104
107
105
- < BrowserSelect
106
- disabled = { braveShields === 'block' }
107
- titleName = { getMessage ( 'shieldsControlsCookieControl' ) }
108
- value = { braveShields !== 'block' ? cookies : 'allow' }
109
- onChange = { this . onChangeCookiesProtection }
110
- >
111
- < option value = 'block_third_party' > { getMessage ( 'shieldsControlsCookieOptionBlock3p' ) } </ option >
112
- < option value = 'block' > { getMessage ( 'shieldsControlsCookieOptionBlockAll' ) } </ option >
113
- < option value = 'allow' > { getMessage ( 'shieldsControlsCookieOptionAllowAll' ) } </ option >
114
- </ BrowserSelect >
108
+ < SelectOption
109
+ id = 'shieldsControlsCookieControl'
110
+ disabled = { braveShields === 'block' }
111
+ titleName = { getMessage ( 'shieldsControlsCookieControl' ) }
112
+ value = { braveShields !== 'block' ? cookies : 'allow' }
113
+ onChange = { this . onChangeCookiesProtection }
114
+ >
115
+ < option value = 'block_third_party' > { getMessage ( 'shieldsControlsCookieOptionBlock3p' ) } </ option >
116
+ < option value = 'block' > { getMessage ( 'shieldsControlsCookieOptionBlockAll' ) } </ option >
117
+ < option value = 'allow' > { getMessage ( 'shieldsControlsCookieOptionAllowAll' ) } </ option >
118
+ </ SelectOption >
115
119
116
- < BrowserSelect
117
- disabled = { braveShields === 'block' }
118
- titleName = { getMessage ( 'shieldsControlsFingerprintingProtection' ) }
119
- value = { braveShields !== 'block' ? fingerprinting : 'allow' }
120
- onChange = { this . onChangeFingerprintingProtection }
121
- >
122
- < option value = 'block_third_party' > { getMessage ( 'shieldsControlsFingerprintingOptionBlock3p' ) } </ option >
123
- < option value = 'block' > { getMessage ( 'shieldsControlsFingerprintingOptionBlockAll' ) } </ option >
124
- < option value = 'allow' > { getMessage ( 'shieldsControlsFingerprintingOptionAllowAll' ) } </ option >
125
- </ BrowserSelect >
126
- < Grid
127
- gap = '10px 5px'
128
- padding = '5px 0'
129
- >
130
- < Column >
131
- { /* TODO @cezaraugusto */ }
132
- < SwitchButton
133
- id = 'httpsEverywhere'
134
- disabled = { braveShields === 'block' }
135
- rightText = { getMessage ( 'shieldsControlsHttpsEverywhereSwitch' ) }
136
- checked = { braveShields !== 'block' && httpUpgradableResources !== 'allow' }
137
- onChange = { this . onToggleHTTPSEverywhere }
138
- />
139
- </ Column >
140
- < Column >
141
- { /* TODO @cezaraugusto */ }
142
- < SwitchButton
143
- id = 'blockScripts'
144
- disabled = { braveShields === 'block' }
145
- rightText = { getMessage ( 'shieldsControlsBlockScriptsSwitch' ) }
146
- checked = { braveShields !== 'block' && javascript !== 'allow' }
147
- onChange = { this . onToggleJavaScript }
148
- />
149
- </ Column >
150
- < Column >
151
- { /* TODO @cezaraugusto */ }
152
- < SwitchButton
153
- id = 'blockPhishingMalware'
154
- checked = { false }
155
- disabled = { braveShields === 'block' }
156
- rightText = { getMessage ( 'shieldsControlsBlockPhishingMalwareSwitch' ) }
157
- />
158
- </ Column >
159
- </ Grid >
120
+ < SelectOption
121
+ id = 'shieldsControlsFingerprintingProtection'
122
+ disabled = { braveShields === 'block' }
123
+ titleName = { getMessage ( 'shieldsControlsFingerprintingProtection' ) }
124
+ value = { braveShields !== 'block' ? fingerprinting : 'allow' }
125
+ onChange = { this . onChangeFingerprintingProtection }
126
+ >
127
+ < option value = 'block_third_party' > { getMessage ( 'shieldsControlsFingerprintingOptionBlock3p' ) } </ option >
128
+ < option value = 'block' > { getMessage ( 'shieldsControlsFingerprintingOptionBlockAll' ) } </ option >
129
+ < option value = 'allow' > { getMessage ( 'shieldsControlsFingerprintingOptionAllowAll' ) } </ option >
130
+ </ SelectOption >
131
+
132
+ < Grid theme = { theme . braveShieldsControlsSwitches } >
133
+ < Column >
134
+ { /* TODO @cezaraugusto */ }
135
+ < SwitchButton
136
+ id = 'httpsEverywhere'
137
+ disabled = { braveShields === 'block' }
138
+ rightText = { getMessage ( 'shieldsControlsHttpsEverywhereSwitch' ) }
139
+ checked = { braveShields !== 'block' && httpUpgradableResources !== 'allow' }
140
+ onChange = { this . onToggleHTTPSEverywhere }
141
+ />
142
+ </ Column >
143
+ < Column >
144
+ { /* TODO @cezaraugusto */ }
145
+ < SwitchButton
146
+ id = 'blockScripts'
147
+ disabled = { braveShields === 'block' }
148
+ rightText = { getMessage ( 'shieldsControlsBlockScriptsSwitch' ) }
149
+ checked = { braveShields !== 'block' && javascript !== 'allow' }
150
+ onChange = { this . onToggleJavaScript }
151
+ />
152
+ </ Column >
153
+ < Column >
154
+ { /* TODO @cezaraugusto */ }
155
+ < SwitchButton
156
+ id = 'blockPhishingMalware'
157
+ checked = { false }
158
+ disabled = { braveShields === 'block' }
159
+ rightText = { getMessage ( 'shieldsControlsBlockPhishingMalwareSwitch' ) }
160
+ />
161
+ </ Column >
162
+ </ Grid >
160
163
< NoScript
161
164
blocked = { javascript !== 'allow' }
162
165
noScriptInfo = { noScriptInfo }
163
166
onSubmit = { this . onAllowScriptOriginsOnce }
164
167
onChangeNoScriptSettings = { this . onChangeNoScriptSettings }
165
168
/>
166
- </ ContentToggle >
169
+ </ BoxedContent >
170
+ </ ContentToggleArrow >
167
171
</ Column >
168
172
</ Grid >
169
173
)
0 commit comments