Skip to content

Commit 8b2777c

Browse files
authored
Time range selector changes (#42)
* changed time picker dropdown designs * change time setting button * added dark and light
1 parent ca4f876 commit 8b2777c

File tree

4 files changed

+40
-19
lines changed

4 files changed

+40
-19
lines changed

packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerContent.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ export const TimePickerContentWithScreenSize: React.FC<PropsWithScreenSize> = (p
7777
return (
7878
<div id="TimePickerContent" className={cx(styles.container, className)}>
7979
<div className={styles.body}>
80-
{isFullscreen && (
81-
<div className={styles.leftSide}>
82-
<FullScreenForm {...props} historyOptions={historyOptions} />
83-
</div>
84-
)}
8580
{(!isFullscreen || !hideQuickRanges) && (
8681
<div className={styles.rightSide}>
8782
<div className={styles.timeRangeFilter}>
@@ -101,6 +96,11 @@ export const TimePickerContentWithScreenSize: React.FC<PropsWithScreenSize> = (p
10196
</CustomScrollbar>
10297
</div>
10398
)}
99+
{isFullscreen && (
100+
<div className={styles.leftSide}>
101+
<FullScreenForm {...props} historyOptions={historyOptions} />
102+
</div>
103+
)}
104104
</div>
105105
{!hideTimeZone && isFullscreen && (
106106
<TimePickerFooter
@@ -185,10 +185,7 @@ const FullScreenForm: React.FC<FormProps> = (props) => {
185185
className={styles.container}
186186
style={{
187187
height: '100%',
188-
display: 'flex',
189-
flexDirection: 'column',
190-
justifyContent: 'center',
191-
alignItems: 'center',
188+
padding: '25px',
192189
}}
193190
>
194191
<div className={styles.title} data-testid={selectors.components.TimePicker.absoluteTimeRangeTitle}>
@@ -279,18 +276,18 @@ const getStyles = stylesFactory((theme: GrafanaTheme2, isReversed, hideQuickRang
279276
body: css`
280277
display: flex;
281278
flex-direction: row-reverse;
282-
height: ${isContainerTall ? '381px' : '217px'};
279+
height: ${isContainerTall ? '281px' : '217px'};
283280
`,
284281
leftSide: css`
285282
display: flex;
286283
flex-direction: column;
287284
border-right: ${isReversed ? 'none' : `1px solid ${theme.colors.border.weak}`};
288-
width: ${!hideQuickRanges ? '60%' : '100%'};
285+
width: ${!hideQuickRanges ? '50%' : '100%'};
289286
overflow: hidden;
290287
order: ${isReversed ? 1 : 0};
291288
`,
292289
rightSide: css`
293-
width: ${isFullscreen ? '40%' : '100%'}; !important;
290+
width: ${isFullscreen ? '50%' : '100%'}; !important;
294291
border-right: ${isReversed ? `1px solid ${theme.colors.border.weak}` : 'none'};
295292
display: flex;
296293
flex-direction: column;

packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,11 @@ export const TimePickerFooter: FC<Props> = (props) => {
5656
return null;
5757
}
5858

59+
const fnColor = theme.isDark ? '#8EC4AD' : '#3A785E';
60+
5961
return (
6062
<div>
6163
<section aria-label="Time zone selection" className={style.container}>
62-
<Button variant="secondary" onClick={onToggleChangeTimeSettings} size="sm">
63-
Change time settings
64-
</Button>
65-
<div className={style.spacer} />
6664
<div className={style.timeZoneContainer}>
6765
<div className={style.timeZone}>
6866
<TimeZoneTitle title={info.name} />
@@ -71,6 +69,18 @@ export const TimePickerFooter: FC<Props> = (props) => {
7169
</div>
7270
<TimeZoneOffset timeZone={timeZone} timestamp={timestamp} />
7371
</div>
72+
<div className={style.spacer} />
73+
<Button
74+
onClick={onToggleChangeTimeSettings}
75+
size="md"
76+
style={{
77+
backgroundColor: '#ffffff00',
78+
color: fnColor,
79+
border: `1px solid ${fnColor}`,
80+
}}
81+
>
82+
Change time settings
83+
</Button>
7484
</section>
7585
{isEditing ? (
7686
<div className={style.editContainer}>
@@ -135,6 +145,7 @@ const getStyle = stylesFactory((theme: GrafanaTheme2) => {
135145
flex-direction: row;
136146
justify-content: space-between;
137147
align-items: center;
148+
height: 60px;
138149
`,
139150
editContainer: css`
140151
border-top: 1px solid ${theme.colors.border.weak};

packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeForm.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,15 @@ export const TimeRangeForm: React.FC<Props> = (props) => {
139139
</Field>
140140
{fyTooltip}
141141
</div>
142-
<Button data-testid={selectors.components.TimePicker.applyTimeRange} onClick={onApply}>
142+
<Button
143+
data-testid={selectors.components.TimePicker.applyTimeRange}
144+
onClick={onApply}
145+
style={{
146+
width: '100%',
147+
textAlign: 'center',
148+
paddingLeft: '55px',
149+
}}
150+
>
143151
Apply time range
144152
</Button>
145153

packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneDescription.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, useMemo } from 'react';
33

44
import { GrafanaTheme, TimeZoneInfo } from '@grafana/data';
55

6-
import { useTheme, stylesFactory } from '../../../themes';
6+
import { useTheme, stylesFactory, useTheme2 } from '../../../themes';
77

88
interface Props {
99
info?: TimeZoneInfo;
@@ -13,12 +13,17 @@ export const TimeZoneDescription: React.FC<PropsWithChildren<Props>> = ({ info }
1313
const theme = useTheme();
1414
const styles = getStyles(theme);
1515
const description = useDescription(info);
16+
const { isDark } = useTheme2();
1617

1718
if (!info) {
1819
return null;
1920
}
2021

21-
return <div className={styles.description}>{description}</div>;
22+
return (
23+
<div className={styles.description} style={{ color: isDark ? '#F27A40' : '#BF470D' }}>
24+
{description}
25+
</div>
26+
);
2227
};
2328

2429
const useDescription = (info?: TimeZoneInfo): string => {

0 commit comments

Comments
 (0)