( type: string, filePath: string, small = false )
| 513 | * Generate HTML for install dropdown button |
| 514 | */ |
| 515 | export function getInstallDropdownHtml( |
| 516 | type: string, |
| 517 | filePath: string, |
| 518 | small = false |
| 519 | ): string { |
| 520 | const vscodeUrl = getVSCodeInstallUrl(type, filePath, false); |
| 521 | const insidersUrl = getVSCodeInstallUrl(type, filePath, true); |
| 522 | |
| 523 | if (!vscodeUrl) return ""; |
| 524 | |
| 525 | const sizeClass = small ? "install-dropdown-small" : ""; |
| 526 | const uniqueId = `install-${filePath.replace(/[^a-zA-Z0-9]/g, "-")}`; |
| 527 | |
| 528 | return ` |
| 529 | <div class="install-dropdown ${sizeClass}" id="${uniqueId}" data-install-scope="list"> |
| 530 | <a href="${vscodeUrl}" class="btn btn-primary ${ |
| 531 | small ? "btn-small" : "" |
| 532 | } install-btn-main" target="_blank" rel="noopener"> |
| 533 | Install |
| 534 | </a> |
| 535 | <button type="button" class="btn btn-primary ${ |
| 536 | small ? "btn-small" : "" |
| 537 | } install-btn-toggle" aria-label="Install options" aria-expanded="false"> |
| 538 | <svg viewBox="0 0 16 16" width="12" height="12" fill="currentColor"> |
| 539 | <path d="M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z"/> |
| 540 | </svg> |
| 541 | </button> |
| 542 | <div class="install-dropdown-menu"> |
| 543 | <a href="${vscodeUrl}" target="_blank" rel="noopener"> |
| 544 | VS Code |
| 545 | </a> |
| 546 | <a href="${insidersUrl}" target="_blank" rel="noopener"> |
| 547 | VS Code Insiders |
| 548 | </a> |
| 549 | </div> |
| 550 | </div> |
| 551 | `; |
| 552 | } |
| 553 | |
| 554 | /** |
| 555 | * Setup dropdown close handlers for dynamically created dropdowns |
no test coverage detected