1
1
import { h } from 'preact' ;
2
- import { useContext } from 'preact/hooks' ;
3
2
import { AiChatColorIcon , AiChatIcon , SearchColorIcon , SearchIcon } from '../../components/Icons.js' ;
4
- import { CustomizerThemesContext } from '../../customizer/CustomizerProvider.js' ;
5
3
import { useTypedTranslationWith } from '../../types' ;
6
4
import styles from './TabSwitcher.module.css' ;
7
5
@@ -17,11 +15,14 @@ import styles from './TabSwitcher.module.css';
17
15
*/
18
16
export function TabSwitcher ( { mode, onChange } ) {
19
17
const { t } = useTypedTranslationWith ( /** @type {Strings } */ ( { } ) ) ;
20
- const { main } = useContext ( CustomizerThemesContext ) ;
21
- const Blob = main . value === 'light' ? BlobLight : BlobDark ;
22
18
return (
23
- < div class = { styles . tabSwitcher } role = "tablist" aria-label = { t ( 'omnibar_tabSwitcherLabel' ) } >
24
- < Blob class = { styles . blob } style = { { translate : mode === 'search' ? 0 : 92 } } />
19
+ < div
20
+ class = { styles . tabSwitcher }
21
+ style = { { '--tab-count' : 2 , '--tab-index' : mode === 'search' ? 0 : 1 } }
22
+ role = "tablist"
23
+ aria-label = { t ( 'omnibar_tabSwitcherLabel' ) }
24
+ >
25
+ < div class = { styles . blob } />
25
26
< button class = { styles . tab } role = "tab" aria-selected = { mode === 'search' } onClick = { ( ) => onChange ( 'search' ) } >
26
27
{ mode === 'search' ? < SearchColorIcon /> : < SearchIcon /> }
27
28
< span class = { styles . tabLabel } > { t ( 'omnibar_searchTabLabel' ) } </ span >
@@ -33,97 +34,3 @@ export function TabSwitcher({ mode, onChange }) {
33
34
</ div >
34
35
) ;
35
36
}
36
-
37
- /**
38
- * @param {import('preact').JSX.SVGAttributes<SVGSVGElement> } props
39
- */
40
- function BlobLight ( props ) {
41
- return (
42
- < svg xmlns = "http://www.w3.org/2000/svg" width = "102" height = "36" viewBox = "0 0 102 36" fill = "none" { ...props } >
43
- < g filter = "url(#filter0_ddi_9483_24565)" >
44
- < path
45
- d = "M2 18C2 9.16344 9.16344 2 18 2H78C86.8366 2 94 9.16344 94 18C94 26.8366 86.8366 34 78 34H18C9.16345 34 2 26.8366 2 18Z"
46
- fill = "white"
47
- />
48
- </ g >
49
- < defs >
50
- < filter
51
- id = "filter0_ddi_9483_24565"
52
- x = "-6"
53
- y = "-2"
54
- width = "108"
55
- height = "48"
56
- filterUnits = "userSpaceOnUse"
57
- color-interpolation-filters = "sRGB"
58
- >
59
- < feFlood flood-opacity = "0" result = "BackgroundImageFix" />
60
- < feColorMatrix in = "SourceAlpha" type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result = "hardAlpha" />
61
- < feOffset dy = "4" />
62
- < feGaussianBlur stdDeviation = "4" />
63
- < feComposite in2 = "hardAlpha" operator = "out" />
64
- < feColorMatrix type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0" />
65
- < feBlend mode = "normal" in2 = "BackgroundImageFix" result = "effect1_dropShadow_9483_24565" />
66
- < feColorMatrix in = "SourceAlpha" type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result = "hardAlpha" />
67
- < feOffset dy = "1" />
68
- < feGaussianBlur stdDeviation = "2" />
69
- < feComposite in2 = "hardAlpha" operator = "out" />
70
- < feColorMatrix type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0" />
71
- < feBlend mode = "normal" in2 = "effect1_dropShadow_9483_24565" result = "effect2_dropShadow_9483_24565" />
72
- < feBlend mode = "normal" in = "SourceGraphic" in2 = "effect2_dropShadow_9483_24565" result = "shape" />
73
- < feColorMatrix in = "SourceAlpha" type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result = "hardAlpha" />
74
- < feOffset dy = "1" />
75
- < feComposite in2 = "hardAlpha" operator = "arithmetic" k2 = "-1" k3 = "1" />
76
- < feColorMatrix type = "matrix" values = "0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.48 0" />
77
- < feBlend mode = "normal" in2 = "shape" result = "effect3_innerShadow_9483_24565" />
78
- </ filter >
79
- </ defs >
80
- </ svg >
81
- ) ;
82
- }
83
-
84
- /**
85
- * @param {import('preact').JSX.SVGAttributes<SVGSVGElement> } props
86
- */
87
- function BlobDark ( props ) {
88
- return (
89
- < svg xmlns = "http://www.w3.org/2000/svg" width = "102" height = "36" viewBox = "0 0 102 36" fill = "none" { ...props } >
90
- < g filter = "url(#filter0_ddi_9483_35175)" >
91
- < path
92
- d = "M2 18C2 9.16344 9.16344 2 18 2H78C86.8366 2 94 9.16344 94 18C94 26.8366 86.8366 34 78 34H18C9.16345 34 2 26.8366 2 18Z"
93
- fill = "#6B6B6B"
94
- />
95
- </ g >
96
- < defs >
97
- < filter
98
- id = "filter0_ddi_9483_35175"
99
- x = "-6"
100
- y = "-2"
101
- width = "108"
102
- height = "48"
103
- filterUnits = "userSpaceOnUse"
104
- color-interpolation-filters = "sRGB"
105
- >
106
- < feFlood flood-opacity = "0" result = "BackgroundImageFix" />
107
- < feColorMatrix in = "SourceAlpha" type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result = "hardAlpha" />
108
- < feOffset dy = "4" />
109
- < feGaussianBlur stdDeviation = "4" />
110
- < feComposite in2 = "hardAlpha" operator = "out" />
111
- < feColorMatrix type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.24 0" />
112
- < feBlend mode = "normal" in2 = "BackgroundImageFix" result = "effect1_dropShadow_9483_35175" />
113
- < feColorMatrix in = "SourceAlpha" type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result = "hardAlpha" />
114
- < feOffset dy = "1" />
115
- < feGaussianBlur stdDeviation = "2" />
116
- < feComposite in2 = "hardAlpha" operator = "out" />
117
- < feColorMatrix type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.24 0" />
118
- < feBlend mode = "normal" in2 = "effect1_dropShadow_9483_35175" result = "effect2_dropShadow_9483_35175" />
119
- < feBlend mode = "normal" in = "SourceGraphic" in2 = "effect2_dropShadow_9483_35175" result = "shape" />
120
- < feColorMatrix in = "SourceAlpha" type = "matrix" values = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result = "hardAlpha" />
121
- < feOffset dy = "1" />
122
- < feComposite in2 = "hardAlpha" operator = "arithmetic" k2 = "-1" k3 = "1" />
123
- < feColorMatrix type = "matrix" values = "0 0 0 0 0.976471 0 0 0 0 0.976471 0 0 0 0 0.976471 0 0 0 0.06 0" />
124
- < feBlend mode = "normal" in2 = "shape" result = "effect3_innerShadow_9483_35175" />
125
- </ filter >
126
- </ defs >
127
- </ svg >
128
- ) ;
129
- }
0 commit comments