@@ -1304,81 +1304,77 @@ export const SearchBar = component$(() => {
1304
1304
];
1305
1305
1306
1306
return (
1307
- <PreviewCodeExample >
1308
- <div class = " flex flex-col items-center gap-4 p-4" q :slot = " actualComponent" >
1309
- <div >
1310
- <Combobox
1311
- bind :inputValueSig = { inputValueSig }
1312
- bind :inputRef = { inputRef }
1313
- bind :highlightedIndexSig = { highlightedIndexSig }
1314
- bind :isListboxOpenSig = { isListboxOpenSig }
1315
- optionValueKey = " component"
1316
- class = " w-fit"
1317
- options = { components }
1307
+ <Combobox
1308
+ bind :inputValueSig = { inputValueSig }
1309
+ bind :inputRef = { inputRef }
1310
+ bind :highlightedIndexSig = { highlightedIndexSig }
1311
+ bind :isListboxOpenSig = { isListboxOpenSig }
1312
+ optionValueKey = " component"
1313
+ class = " w-fit"
1314
+ options = { components }
1315
+ >
1316
+ <ComboboxLabel class = " text-white" >Qwik UI ⚡</ComboboxLabel >
1317
+ <ComboboxControl class = " bg-[#1f2532] rounded-sm border-slate-400 border-[1px] relative" >
1318
+ <ComboboxInput
1319
+ onClick$ = { () => (isListboxOpenSig .value = ! isListboxOpenSig .value )}
1320
+ class = " pl-6 w-44 bg-slate-900 px-d2 pr-6 text-white placeholder:text-slate-500"
1321
+ onKeyDown$ = { (e ) => {
1322
+ if (e .key === ' Enter' ) {
1323
+ const inputElement = e .target as HTMLInputElement ;
1324
+ window .location .href = ` ${docsPrefix }/${inputElement .value .toLowerCase ()} ` ;
1325
+ }
1326
+ }}
1327
+ />
1328
+ <ComboboxTrigger class = " w-6 h-6 group absolute left-[4px]" >
1329
+ <SearchIcon />
1330
+ </ComboboxTrigger >
1331
+ { inputValueSig .value .length > 0 && (
1332
+ // give separate id if two triggers
1333
+ <button
1334
+ id = " close-button"
1335
+ aria-label = " clear search"
1336
+ onMouseDown$ = { () => {
1337
+ inputValueSig .value = ' ' ;
1338
+ inputRef .value ?.focus ();
1339
+ }}
1340
+ class = " w-6 h-6 flex justify-center items-center absolute top-0 right-0"
1318
1341
>
1319
- <ComboboxLabel class = " text-white" >Qwik UI ⚡</ComboboxLabel >
1320
- <ComboboxControl class = " bg-[#1f2532] rounded-sm border-slate-400 border-[1px] relative" >
1321
- <ComboboxInput
1322
- onClick$ = { () => (isListboxOpenSig .value = ! isListboxOpenSig .value )}
1323
- class = " pl-6 w-44 bg-slate-900 px-d2 pr-6 text-white placeholder:text-slate-500"
1324
- onKeyDown$ = { (e ) => {
1325
- if (e .key === ' Enter' ) {
1326
- const inputElement = e .target as HTMLInputElement ;
1327
- window .location .href = ` ${docsPrefix }/${inputElement .value .toLowerCase ()} ` ;
1328
- }
1329
- }}
1330
- />
1331
- <ComboboxTrigger class = " w-6 h-6 group absolute left-[4px]" >
1332
- <SearchIcon />
1333
- </ComboboxTrigger >
1334
- { inputValueSig .value .length > 0 && (
1335
- // give separate id if two triggers
1336
- <button
1337
- id = " close-button"
1338
- aria-label = " clear search"
1339
- onMouseDown$ = { () => {
1340
- inputValueSig .value = ' ' ;
1341
- inputRef .value ?.focus ();
1342
- }}
1343
- class = " w-6 h-6 flex justify-center items-center absolute top-0 right-0"
1342
+ <ClearIcon class = " w-4 h-4" />
1343
+ </button >
1344
+ )}
1345
+ </ComboboxControl >
1346
+ <ComboboxPortal >
1347
+ <ComboboxListbox
1348
+ gutter = { 8 }
1349
+ class = " w-44 bg-slate-900 px-1 py-2 rounded-sm border-slate-400 border-[1px]"
1350
+ hide = " escaped"
1351
+ optionRenderer$ = { (option : ResolvedOption , index : number ) => {
1352
+ const searchOption = option .option as MyComponents ;
1353
+ return (
1354
+ <a
1355
+ href = { ` ${docsPrefix }/${searchOption .component } ` }
1356
+ aria-label = { option .label }
1357
+ >
1358
+ <ComboboxOption
1359
+ key = { option .key }
1360
+ class = " aria-disabled:text-slate-600 aria-disabled:hover:bg-slate-700 rounded-sm px-2 hover:bg-slate-500 aria-selected:bg-slate-500 text-white border-2 border-transparent aria-selected:border-slate-200 group flex justify-between items-start gap-4"
1361
+ index = { index }
1362
+ resolved = { option }
1344
1363
>
1345
- <ClearIcon class = " w-4 h-4" />
1346
- </button >
1347
- )}
1348
- </ComboboxControl >
1349
- <ComboboxPortal >
1350
- <ComboboxListbox
1351
- gutter = { 8 }
1352
- class = " w-44 bg-slate-900 px-4 py-2 rounded-sm border-slate-400 border-[1px]"
1353
- hide = " escaped"
1354
- optionRenderer$ = { (option : ResolvedOption , index : number ) => {
1355
- const searchOption = option .option as MyComponents ;
1356
- return (
1357
- <a
1358
- href = { ` ${docsPrefix }/${searchOption .component } ` }
1359
- aria-label = { option .label }
1360
- >
1361
- <ComboboxOption
1362
- key = { option .key }
1363
- class = " aria-disabled:text-slate-600 aria-disabled:hover:bg-slate-700 rounded-sm px-2 hover:bg-slate-500 aria-selected:bg-slate-500 text-white border-2 border-transparent aria-selected:border-slate-200 group"
1364
- index = { index }
1365
- resolved = { option }
1366
- >
1367
- { searchOption .label }
1368
- </ComboboxOption >
1369
- </a >
1370
- );
1371
- }}
1372
- />
1373
- </ComboboxPortal >
1374
- </Combobox >
1375
- </div >
1376
- </div >
1377
-
1378
- <div q :slot = " codeExample" >
1379
- <Slot />
1380
- </div >
1381
- </PreviewCodeExample >
1364
+ <span >{ searchOption .label } </span >
1365
+ <span class = " scale-[0.9]" >
1366
+ { /* this is a Qwik UI docs component */ }
1367
+ <StatusBadge
1368
+ status = { statusByComponent .headless [option .label ]}
1369
+ />
1370
+ </span >
1371
+ </ComboboxOption >
1372
+ </a >
1373
+ );
1374
+ }}
1375
+ />
1376
+ </ComboboxPortal >
1377
+ </Combobox >
1382
1378
);
1383
1379
});
1384
1380
0 commit comments