|
123 | 123 | display: flex; |
124 | 124 | flex-wrap: wrap; |
125 | 125 | gap: 10px; |
| 126 | + } |
| 127 | + |
| 128 | + .example-search-grid { |
| 129 | + display: grid; |
| 130 | + grid-template-columns: repeat(2, minmax(0, 1fr)); |
| 131 | + gap: 16px; |
126 | 132 | margin-top: 16px; |
127 | 133 | } |
128 | 134 |
|
| 135 | + .example-group { |
| 136 | + display: flex; |
| 137 | + flex-direction: column; |
| 138 | + gap: 10px; |
| 139 | + } |
| 140 | + |
| 141 | + .example-group-title { |
| 142 | + color: var(--text-primary); |
| 143 | + font-size: 0.95em; |
| 144 | + font-weight: 600; |
| 145 | + } |
| 146 | + |
| 147 | + .example-group .example-searches { |
| 148 | + margin-top: 0; |
| 149 | + } |
| 150 | + |
129 | 151 | .example-search { |
130 | 152 | border: 1px solid var(--border-color); |
131 | 153 | border-radius: 999px; |
|
404 | 426 | .command { |
405 | 427 | font-size: 0.8em; |
406 | 428 | } |
| 429 | + |
| 430 | + .example-search-grid { |
| 431 | + grid-template-columns: 1fr; |
| 432 | + } |
407 | 433 | } |
408 | 434 | </style> |
409 | 435 | </head> |
@@ -464,12 +490,24 @@ <h1> |
464 | 490 | const statsDiv = document.getElementById('stats'); |
465 | 491 | const lastUpdatedSpan = document.getElementById('last-updated'); |
466 | 492 | const EXAMPLE_SEARCHES = [ |
467 | | - 'Git', |
468 | | - 'Google Chrome', |
469 | | - 'Microsoft Edge', |
470 | | - 'Visual Studio Code', |
471 | | - 'Docker Desktop', |
472 | | - '7-Zip' |
| 493 | + { |
| 494 | + title: 'Dev tools', |
| 495 | + items: [ |
| 496 | + 'Git', |
| 497 | + 'Visual Studio Code', |
| 498 | + 'Docker Desktop', |
| 499 | + 'Node.js', |
| 500 | + 'Python', |
| 501 | + ], |
| 502 | + }, |
| 503 | + { |
| 504 | + title: 'Everyday apps', |
| 505 | + items: [ |
| 506 | + 'Google Chrome', |
| 507 | + 'Microsoft Edge', |
| 508 | + '7-Zip', |
| 509 | + ], |
| 510 | + }, |
473 | 511 | ]; |
474 | 512 |
|
475 | 513 | // Keyboard shortcuts |
|
591 | 629 |
|
592 | 630 | function updateStats(query, totalMatches, showingCount, truncated) { |
593 | 631 | if (!query) { |
594 | | - statsDiv.textContent = `${packages.length.toLocaleString()} packages available • try an example search below`; |
| 632 | + statsDiv.textContent = `${packages.length.toLocaleString()} packages available • try a common search below`; |
595 | 633 | return; |
596 | 634 | } |
597 | 635 |
|
@@ -696,11 +734,18 @@ <h1> |
696 | 734 | function renderEmptyState() { |
697 | 735 | return ` |
698 | 736 | <div class="empty-state"> |
699 | | - <div class="empty-state-kicker">Example searches</div> |
| 737 | + <div class="empty-state-kicker">Try these</div> |
700 | 738 | <h2>Start with a common package</h2> |
701 | 739 | <p>Search by package ID, name, publisher, description, or tag.</p> |
702 | | - <div class="example-searches"> |
703 | | - ${EXAMPLE_SEARCHES.map(example => `<button type="button" class="example-search" onclick="filterBy('${escapeForSingleQuotedJs(example)}')">${escapeHtml(example)}</button>`).join('')} |
| 740 | + <div class="example-search-grid"> |
| 741 | + ${EXAMPLE_SEARCHES.map(group => ` |
| 742 | + <section class="example-group" aria-label="${escapeHtml(group.title)}"> |
| 743 | + <div class="example-group-title">${escapeHtml(group.title)}</div> |
| 744 | + <div class="example-searches"> |
| 745 | + ${group.items.map(example => `<button type="button" class="example-search" onclick="filterBy('${escapeForSingleQuotedJs(example)}')">${escapeHtml(example)}</button>`).join('')} |
| 746 | + </div> |
| 747 | + </section> |
| 748 | + `).join('')} |
704 | 749 | </div> |
705 | 750 | <div class="empty-state-note">You can click a publisher or tag in a result to narrow the search once results appear.</div> |
706 | 751 | </div> |
|
0 commit comments