TimeRangePicker: fix DOM nesting (#37550)

pull/37556/head
Alex Khomenko 4 years ago committed by GitHub
parent 978384b27e
commit 1a46123dbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/grafana-ui/src/components/DateTimePickers/TimeRangeInput.tsx
  2. 8
      packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerContent.tsx
  3. 4
      packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeForm.tsx
  4. 14
      packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeList.tsx

@ -141,6 +141,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme2, disabled = false) => {
inputStyles.suffix, inputStyles.suffix,
css` css`
position: relative; position: relative;
top: -1px;
margin-left: ${theme.v1.spacing.xs}; margin-left: ${theme.v1.spacing.xs};
` `
), ),

@ -232,7 +232,7 @@ const NarrowScreenForm: React.FC<FormProps> = (props) => {
return ( return (
<fieldset> <fieldset>
<h3 className={styles.header}> <div className={styles.header}>
<button <button
className={styles.expandButton} className={styles.expandButton}
onClick={() => { onClick={() => {
@ -247,7 +247,7 @@ const NarrowScreenForm: React.FC<FormProps> = (props) => {
<TimePickerTitle>Absolute time range</TimePickerTitle> <TimePickerTitle>Absolute time range</TimePickerTitle>
{!hideQuickRanges && <Icon name={!collapsed ? 'angle-up' : 'angle-down'} />} {!hideQuickRanges && <Icon name={!collapsed ? 'angle-up' : 'angle-down'} />}
</button> </button>
</h3> </div>
{!collapsed && ( {!collapsed && (
<div className={styles.body} id="expanded-timerange"> <div className={styles.body} id="expanded-timerange">
<div className={styles.form}> <div className={styles.form}>
@ -278,9 +278,9 @@ const FullScreenForm: React.FC<FormProps> = (props) => {
return ( return (
<> <>
<div className={styles.container}> <div className={styles.container}>
<h3 className={styles.title} data-testid={selectors.components.TimePicker.absoluteTimeRangeTitle}> <div className={styles.title} data-testid={selectors.components.TimePicker.absoluteTimeRangeTitle}>
<TimePickerTitle>Absolute time range</TimePickerTitle> <TimePickerTitle>Absolute time range</TimePickerTitle>
</h3> </div>
<TimeRangeForm <TimeRangeForm
value={props.value} value={props.value}
timeZone={props.timeZone} timeZone={props.timeZone}

@ -96,7 +96,7 @@ export const TimeRangeForm: React.FC<Props> = (props) => {
const icon = isFullscreen ? null : <Button icon="calendar-alt" variant="secondary" onClick={onOpen} />; const icon = isFullscreen ? null : <Button icon="calendar-alt" variant="secondary" onClick={onOpen} />;
return ( return (
<form aria-label="Absolute time ranges"> <div aria-label="Absolute time ranges">
<Field label="From" invalid={from.invalid} error={from.errorMessage}> <Field label="From" invalid={from.invalid} error={from.errorMessage}>
<Input <Input
onClick={(event) => event.stopPropagation()} onClick={(event) => event.stopPropagation()}
@ -132,7 +132,7 @@ export const TimeRangeForm: React.FC<Props> = (props) => {
timeZone={timeZone} timeZone={timeZone}
isReversed={isReversed} isReversed={isReversed}
/> />
</form> </div>
); );
}; };

@ -47,14 +47,12 @@ export const TimeRangeList: React.FC<Props> = (props) => {
return ( return (
<section aria-label={title}> <section aria-label={title}>
<form> <fieldset>
<fieldset> <div className={styles.title}>
<div className={styles.title}> <TimePickerTitle>{title}</TimePickerTitle>
<TimePickerTitle>{title}</TimePickerTitle> </div>
</div> <Options {...props} />
<Options {...props} /> </fieldset>
</fieldset>
</form>
</section> </section>
); );
}; };

Loading…
Cancel
Save