1
- /* This Source Code Form is subject to the terms of the Mozilla Public
2
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
1
+ // Copyright (c) 2020 The Brave Authors. All rights reserved.
2
+ // This Source Code Form is subject to the terms of the Mozilla Public
3
+ // License, v. 2.0. If a copy of the MPL was not distributed with this file,
4
+ // you can obtain one at http://mozilla.org/MPL/2.0/.
4
5
5
- import styled , { css } from 'styled-components '
6
+ import styled , { css } from 'brave-ui/theme '
6
7
7
8
interface Props {
8
9
textDirection : string
9
10
}
10
11
11
12
export const SettingsMenu = styled < Props , 'div' > ( 'div' ) `
12
- bottom: 48px;
13
- width: auto;
14
- position: absolute;
13
+ width: 680px;
15
14
${ p => p . textDirection && ( p . textDirection === 'rtl' ) ? `left: 12px` : `right: 12px` }
16
15
background-color: ${ p => p . theme . color . contextMenuBackground } ;
17
16
color: ${ p => p . theme . color . contextMenuForeground } ;
18
17
border-radius: 8px;
19
- padding: 24px 24px 17px 24px ;
18
+ padding: 24px;
20
19
box-shadow: 0px 4px 24px 0px rgba(0, 0, 0, 0.24);
21
20
font-family: ${ p => p . theme . fontFamily . body } ;
22
21
`
23
22
23
+ export const SettingsContent = styled < { } , 'div' > ( 'div' ) `
24
+ display: grid;
25
+ grid-template-columns: auto 1fr;
26
+ grid-gap: 40px;
27
+ `
28
+
29
+ export const SettingsSidebar = styled < { } , 'aside' > ( 'aside' ) `
30
+ position: relative;
31
+ /* normalize against SettingsMenu default padding */
32
+ margin-left: -24px;
33
+ padding-left: 24px;
34
+ `
35
+
36
+ interface SettingsSidebarActiveButtonSliderProps {
37
+ translateTo : number
38
+ }
39
+
40
+ export const SettingsSidebarActiveButtonSlider =
41
+ styled < SettingsSidebarActiveButtonSliderProps , 'div' > ( 'div' ) `
42
+ position: absolute;
43
+ top: 0;
44
+ left: 0;
45
+ height: 48px;
46
+ width: 4px;
47
+ background: linear-gradient(93.83deg, ${ p => p . theme . color . brandBrave } -3.53%, ${ p => p . theme . palette . magenta500 } 110.11%);
48
+ transform: translateY(${ p => p . translateTo * 48 } px);
49
+ transition-delay: 0.05s;
50
+ transition-duration: 0.3s;
51
+ transition-timing-function: ease-in;
52
+ transition-property: transform;
53
+ `
54
+ interface SettingsSidebarSVGContentProps {
55
+ src : string
56
+ }
57
+
58
+ export const SettingsSidebarSVGContent = styled < SettingsSidebarSVGContentProps , 'div' > ( 'div' ) `
59
+ width: 20px;
60
+ height: 20px;
61
+ background: ${ p => p . theme . palette . grey800 } ;
62
+ -webkit-mask-image: url(${ p => p . src } );
63
+ -webkit-mask-repeat: no-repeat;
64
+ -webkit-mask-position: center;
65
+ `
66
+
67
+ export const SettingsSidebarButtonText = styled < { } , 'span' > ( 'span' ) `
68
+ margin-left: 16px;
69
+ font-weight: 500;
70
+ font-size: 13px;
71
+ font-family: ${ p => p . theme . fontFamily . heading } ;
72
+ color: ${ p => p . theme . palette . grey800 } ;
73
+ position: relative;
74
+
75
+ &:hover {
76
+ color: ${ p => p . theme . color . brandBrave } ;
77
+ }
78
+ `
79
+ interface SettingsSidebarButtonProps {
80
+ activeTab : boolean
81
+ }
82
+
83
+ export const SettingsSidebarButton = styled < SettingsSidebarButtonProps , 'button' > ( 'button' ) `
84
+ appearance: none;
85
+ padding: 0;
86
+ margin: 0;
87
+ border: 0;
88
+ width: 220px;
89
+ height: 48px;
90
+ text-align: left;
91
+ cursor: pointer;
92
+ display: flex;
93
+ align-items: center;
94
+
95
+ &:focus {
96
+ outline: none;
97
+ }
98
+
99
+ &:hover {
100
+ ${ SettingsSidebarSVGContent } {
101
+ background: ${ p => p . theme . color . brandBrave } ;
102
+ }
103
+ ${ SettingsSidebarButtonText } {
104
+ color: ${ p => p . theme . color . brandBrave } ;
105
+ }
106
+ }
107
+
108
+ ${ SettingsSidebarSVGContent } {
109
+ ${ p => p . activeTab && css `
110
+ background : linear-gradient (93.83deg , ${ p => p . theme . color . brandBrave } -3.53% , ${ p => p . theme . palette . magenta500 } 110.11% );
111
+ ` }
112
+ }
113
+
114
+ ${ SettingsSidebarButtonText } {
115
+ // Gradientify text
116
+ ${ p => p . activeTab && css `
117
+ background : ${ p => p . theme . color . panelBackground } ;
118
+ ` }
119
+
120
+ // Gradientify text part 2
121
+ &::before {
122
+ ${ p => p . activeTab && css `
123
+ mix-blend-mode : screen;
124
+ content : '' ;
125
+ display : block;
126
+ position : absolute;
127
+ top : 0 ;
128
+ right : 0 ;
129
+ bottom : 0 ;
130
+ left : 0 ;
131
+ transition : linear 0.3s background-image;
132
+ background-image : linear-gradient (93.83deg , ${ p => p . theme . color . brandBrave } -3.53% , ${ p => p . theme . palette . magenta500 } 110.11% );
133
+ ` }
134
+ }
135
+ `
136
+
137
+ export const SettingsFeatureBody = styled < { } , 'section' > ( 'section' ) `
138
+ padding: 10px 16px 0;
139
+ `
140
+
24
141
export const SettingsTitle = styled < { } , 'div' > ( 'div' ) `
25
- font-family: ${ p => p . theme . fontFamily . body } ;
26
- font-size: 18px;
27
- font-weight: bold;
28
- letter-spacing: 0px;
29
142
margin-bottom: 17px;
143
+ grid-template-columns: 1fr 20px;
144
+ display: grid;
145
+ align-items: center;
146
+
147
+ h1 {
148
+ font-family: ${ p => p . theme . fontFamily . heading } ;
149
+ margin: 0;
150
+ font-weight: 600;
151
+ font-size: 20px;
152
+ line-height: 30px;
153
+ letter-spacing: 0.02em;
154
+ color: ${ p => p . theme . color . neutral900 } ;
155
+ }
156
+ `
157
+
158
+ export const SettingsCloseIcon = styled < { } , 'button' > ( 'button' ) `
159
+ appearance: none;
160
+ padding: 0;
161
+ margin: 0;
162
+ border: 0;
163
+ width: 20px;
164
+ height: 20px;
165
+ cursor: pointer;
30
166
`
31
167
32
168
interface SettingsRowProps {
@@ -37,11 +173,11 @@ export const SettingsRow = styled<SettingsRowProps, 'div'>('div')`
37
173
box-sizing: border-box;
38
174
display: grid;
39
175
grid-template-columns: 1fr 36px;
40
- margin-top: 10px ;
41
- height: 30px ;
42
- width: 320px ;
176
+ align-items: center ;
177
+ width: 100% ;
178
+ height: 28px ;
43
179
${ p => p . isChildSetting && css `
44
- padding-left : 15 px ;
180
+ padding-left : 36 px ;
45
181
` }
46
182
`
47
183
@@ -57,9 +193,15 @@ interface SettingsWrapperProps {
57
193
}
58
194
59
195
export const SettingsWrapper = styled < SettingsWrapperProps , 'div' > ( 'div' ) `
60
- position: relative;
196
+ position: absolute;
197
+ top: 0;
198
+ left: 0;
199
+ width: 100%;
200
+ height: 100%;
201
+ z-index: 3;
61
202
display: flex;
62
- justify-content: flex-end;
203
+ justify-content: center;
204
+ align-items: center;
63
205
font-family: ${ p => p . theme . fontFamily . heading } ;
64
206
font-size: 13px;
65
207
font-weight: 600;
0 commit comments