@@ -3,8 +3,13 @@ import {
33 DescriptionListDescription ,
44 DescriptionListGroup ,
55 DescriptionListTerm ,
6+ Flex ,
7+ FlexItem ,
68 FormGroup ,
79 NumberInput ,
10+ Text ,
11+ TextVariants ,
12+ Title ,
813} from '@patternfly/react-core' ;
914import * as React from 'react' ;
1015import { TFunction } from 'react-i18next' ;
@@ -45,22 +50,26 @@ const TimeRangeFormGroup: React.FC<TimeRangeFormGroupProps> = ({
4550 onChange ( new time . Duration ( Math . max ( 1 , d ) , duration . unit ) ) ;
4651
4752 const recentPicker = (
48- < >
49- Since
50- < NumberInput
51- value = { duration . count }
52- min = { 0 }
53- onPlus = { ( ) => onChangeDuration ( duration . count + 1 ) }
54- onMinus = { ( ) => onChangeDuration ( duration . count - 1 ) }
55- onChange = { ( e ) => onChangeDuration ( Number ( ( e . target as HTMLInputElement ) . value ) ) }
56- widthChars = { 3 }
57- />
58- < TimeUnitPicker
59- unit = { duration . unit }
60- onChange = { ( unit : time . Unit ) => onChange ( new time . Duration ( duration . count , unit ) ) }
61- />
62- ago
63- </ >
53+ < Flex >
54+ < FlexItem >
55+ < Text component = { TextVariants . h6 } > { t ( 'Since' ) } </ Text >
56+ < NumberInput
57+ value = { duration . count }
58+ min = { 0 }
59+ onPlus = { ( ) => onChangeDuration ( duration . count + 1 ) }
60+ onMinus = { ( ) => onChangeDuration ( duration . count - 1 ) }
61+ onChange = { ( e ) => onChangeDuration ( Number ( ( e . target as HTMLInputElement ) . value ) ) }
62+ widthChars = { 3 }
63+ />
64+ </ FlexItem >
65+ < FlexItem >
66+ < Text component = { TextVariants . h6 } > { t ( 'Ago' ) } </ Text >
67+ < TimeUnitPicker
68+ unit = { duration . unit }
69+ onChange = { ( unit : time . Unit ) => onChange ( new time . Duration ( duration . count , unit ) ) }
70+ />
71+ </ FlexItem >
72+ </ Flex >
6473 ) ;
6574
6675 // FXIME allow blank, -toggle.
@@ -103,20 +112,25 @@ const TimeRangeFormGroup: React.FC<TimeRangeFormGroupProps> = ({
103112
104113 return (
105114 < FormGroup
106- label = < >
107- { label }
108- { help }
109- </ >
115+ label = {
116+ < Title headingLevel = "h4" >
117+ { label } { help }
118+ </ Title >
119+ }
110120 >
111- < Chooser
112- selectedID = { type }
113- onChange = { ( id : string ) => onChange ( id === RECENT ? duration : range ) }
114- items = { [
115- { id : RECENT , label : t ( 'Recent' ) } ,
116- { id : RANGE , label : t ( 'Range' ) } ,
117- ] }
118- />
119- { type === RECENT ? recentPicker : rangePicker }
121+ < Flex direction = { { default : 'column' } } >
122+ < FlexItem >
123+ < Chooser
124+ selectedID = { type }
125+ onChange = { ( id : string ) => onChange ( id === RECENT ? duration : range ) }
126+ items = { [
127+ { id : RECENT , label : t ( 'Recent' ) } ,
128+ { id : RANGE , label : t ( 'Range' ) } ,
129+ ] }
130+ />
131+ </ FlexItem >
132+ < FlexItem > { type === RECENT ? recentPicker : rangePicker } </ FlexItem >
133+ </ Flex >
120134 </ FormGroup >
121135 ) ;
122136} ;
0 commit comments