Debian Codegraph @

node/@patternfly/react-core/src/components/Progress/examples/ProgressInteractiveFailure.tsx

raw
1 import { useState } from 'react';
2 import {
3 Progress,
4 ProgressMeasureLocation,
5 ProgressVariant,
6 Radio,
7 Checkbox,
8 Form,
9 FormGroup
10 } from '@patternfly/react-core';
11
12 export const ProgressInteractiveFailure: React.FunctionComponent = () => {
13 const [measureLocation, setMeasureLocation] = useState<ProgressMeasureLocation>(ProgressMeasureLocation.inside);
14 const [hideStatusIcon, setHideStatusIcon] = useState<boolean>(false);
15
16 const measureLocationOptions = [
17 { value: ProgressMeasureLocation.inside, label: 'Inside' },
18 { value: ProgressMeasureLocation.outside, label: 'Outside' },
19 { value: ProgressMeasureLocation.top, label: 'Top' },
20 { value: ProgressMeasureLocation.none, label: 'None' }
21 ];
22
23 return (
24 <Form>
25 <FormGroup fieldId="measure-location" label="Measure location">
26 {measureLocationOptions.map((option) => (
27 <Radio
28 key={option.value}
29 id={`measure-location-${option.value}`}
30 name="measure-location"
31 label={option.label}
32 value={option.value}
33 isChecked={measureLocation === option.value}
34 onChange={() => setMeasureLocation(option.value)}
35 />
36 ))}
37 </FormGroup>
38 <FormGroup fieldId="hide-status-icon">
39 <Checkbox
40 id="hide-status-icon"
41 label="Hide status icon"
42 isChecked={hideStatusIcon}
43 onChange={(_, checked) => setHideStatusIcon(checked)}
44 />
45 </FormGroup>
46 <Progress
47 value={33}
48 title="Title"
49 measureLocation={measureLocation}
50 variant={ProgressVariant.danger}
51 hideStatusIcon={hideStatusIcon}
52 />
53 </Form>
54 );
55 };