|
1 | | -import { TriangleDownIcon, XCircleIcon } from '@primer/octicons-react'; |
2 | | -import { ActionList, ActionMenu, Button, Overlay } from '@primer/react'; |
3 | | -import { VSCodeLink, VSCodeTag } from '@vscode/webview-ui-toolkit/react'; |
| 1 | +import { XCircleIcon } from '@primer/octicons-react'; |
| 2 | +import { Overlay } from '@primer/react'; |
| 3 | +import { VSCodeDropdown, VSCodeLink, VSCodeOption, VSCodeTag } from '@vscode/webview-ui-toolkit/react'; |
4 | 4 | import * as React from 'react'; |
5 | | -import { useRef, useState } from 'react'; |
| 5 | +import { ChangeEvent, useRef, useState } from 'react'; |
6 | 6 | import styled from 'styled-components'; |
7 | 7 | import { CodeFlow, AnalysisMessage, ResultSeverity } from '../shared/analysis-result'; |
8 | 8 | import FileCodeSnippet from './FileCodeSnippet'; |
@@ -94,25 +94,22 @@ const Menu = ({ |
94 | 94 | codeFlows: CodeFlow[], |
95 | 95 | setSelectedCodeFlow: (value: React.SetStateAction<CodeFlow>) => void |
96 | 96 | }) => { |
97 | | - return <ActionMenu> |
98 | | - <ActionMenu.Anchor> |
99 | | - <Button variant="invisible" sx={{ fontWeight: 'normal', color: 'var(--vscode-editor-foreground);', padding: 0 }} > |
100 | | - {getCodeFlowName(codeFlows[0])} |
101 | | - <TriangleDownIcon size={16} /> |
102 | | - </Button> |
103 | | - </ActionMenu.Anchor> |
104 | | - <ActionMenu.Overlay sx={{ backgroundColor: 'var(--vscode-editor-background)' }}> |
105 | | - <ActionList> |
106 | | - {codeFlows.map((codeFlow, index) => |
107 | | - <ActionList.Item |
108 | | - key={`codeflow-${index}'`} |
109 | | - onSelect={(e: React.MouseEvent) => { setSelectedCodeFlow(codeFlow); }}> |
110 | | - {getCodeFlowName(codeFlow)} |
111 | | - </ActionList.Item> |
112 | | - )} |
113 | | - </ActionList> |
114 | | - </ActionMenu.Overlay> |
115 | | - </ActionMenu>; |
| 97 | + return <VSCodeDropdown |
| 98 | + onChange={(event: ChangeEvent<HTMLSelectElement>) => { |
| 99 | + const selectedOption = event.target; |
| 100 | + const selectedIndex = selectedOption.value as unknown as number; |
| 101 | + setSelectedCodeFlow(codeFlows[selectedIndex]); |
| 102 | + }} |
| 103 | + > |
| 104 | + {codeFlows.map((codeFlow, index) => |
| 105 | + <VSCodeOption |
| 106 | + key={`codeflow-${index}'`} |
| 107 | + value={index} |
| 108 | + > |
| 109 | + {getCodeFlowName(codeFlow)} |
| 110 | + </VSCodeOption> |
| 111 | + )} |
| 112 | + </VSCodeDropdown>; |
116 | 113 | }; |
117 | 114 |
|
118 | 115 | const CodePaths = ({ |
|
0 commit comments