|
1 | 1 | import React, { useState } from 'react';
|
2 | 2 |
|
3 |
| -import { FormGroup } from '@patternfly/react-core'; |
4 | 3 | import {
|
| 4 | + FormGroup, |
| 5 | + MenuToggle, |
| 6 | + MenuToggleElement, |
5 | 7 | Select,
|
| 8 | + SelectList, |
6 | 9 | SelectOption,
|
7 |
| - SelectVariant, |
8 |
| -} from '@patternfly/react-core/deprecated'; |
| 10 | +} from '@patternfly/react-core'; |
9 | 11 |
|
10 | 12 | import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
11 | 13 | import {
|
@@ -42,25 +44,32 @@ export const AzureHyperVSelect = () => {
|
42 | 44 | />,
|
43 | 45 | ];
|
44 | 46 |
|
| 47 | + const toggle = (toggleRef: React.Ref<MenuToggleElement>) => ( |
| 48 | + <MenuToggle |
| 49 | + ref={toggleRef} |
| 50 | + data-testid="azure-hyper-v-generation-select" |
| 51 | + onClick={() => setIsOpen(!isOpen)} |
| 52 | + isExpanded={isOpen} |
| 53 | + isFullWidth |
| 54 | + > |
| 55 | + {hyperVGeneration === 'V1' ? 'Generation 1' : 'Generation 2'} |
| 56 | + </MenuToggle> |
| 57 | + ); |
| 58 | + |
45 | 59 | return (
|
46 | 60 | <>
|
47 |
| - <FormGroup |
48 |
| - isRequired |
49 |
| - label="HyperV Generation" |
50 |
| - data-testid="azure-hyper-v-generation-select" |
51 |
| - > |
| 61 | + <FormGroup isRequired label="HyperV Generation"> |
52 | 62 | <Select
|
53 | 63 | ouiaId="hyperv_gen_select"
|
54 |
| - variant={SelectVariant.single} |
55 |
| - onToggle={handleToggle} |
56 |
| - onSelect={handleSelect} |
| 64 | + isScrollable |
57 | 65 | isOpen={isOpen}
|
58 |
| - selections={ |
59 |
| - hyperVGeneration === 'V1' ? 'Generation 1' : 'Generation 2' |
60 |
| - } |
61 |
| - value={hyperVGeneration} |
| 66 | + selected={hyperVGeneration === 'V1' ? 'Generation 1' : 'Generation 2'} |
| 67 | + onSelect={handleSelect} |
| 68 | + onOpenChange={handleToggle} |
| 69 | + toggle={toggle} |
| 70 | + shouldFocusFirstItemOnOpen={false} |
62 | 71 | >
|
63 |
| - {selectOptions} |
| 72 | + <SelectList>{selectOptions}</SelectList> |
64 | 73 | </Select>
|
65 | 74 | </FormGroup>
|
66 | 75 | </>
|
|
0 commit comments