Skip to content

Commit 80a90f4

Browse files
gurinder39Katarzyna Ziomek-Zdanowicz
authored and
Katarzyna Ziomek-Zdanowicz
committed
Time range selector changes (#42)
* changed time picker dropdown designs * change time setting button * added dark and light
1 parent 80a486f commit 80a90f4

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
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
@@ -78,11 +78,6 @@ export const TimePickerContentWithScreenSize: React.FC<PropsWithScreenSize> = (p
7878
return (
7979
<div id="TimePickerContent" className={cx(styles.container, className)}>
8080
<div className={styles.body}>
81-
{isFullscreen && (
82-
<div className={styles.leftSide}>
83-
<FullScreenForm {...props} historyOptions={historyOptions} />
84-
</div>
85-
)}
8681
{(!isFullscreen || !hideQuickRanges) && (
8782
<div className={styles.rightSide}>
8883
<div className={styles.timeRangeFilter}>
@@ -102,6 +97,11 @@ export const TimePickerContentWithScreenSize: React.FC<PropsWithScreenSize> = (p
10297
</CustomScrollbar>
10398
</div>
10499
)}
100+
{isFullscreen && (
101+
<div className={styles.leftSide}>
102+
<FullScreenForm {...props} historyOptions={historyOptions} />
103+
</div>
104+
)}
105105
</div>
106106
{!hideTimeZone && isFullscreen && (
107107
<TimePickerFooter
@@ -189,10 +189,7 @@ const FullScreenForm: React.FC<FormProps> = (props) => {
189189
className={styles.container}
190190
style={{
191191
height: '100%',
192-
display: 'flex',
193-
flexDirection: 'column',
194-
justifyContent: 'center',
195-
alignItems: 'center',
192+
padding: '25px',
196193
}}
197194
>
198195
<div className={styles.title} data-testid={selectors.components.TimePicker.absoluteTimeRangeTitle}>
@@ -287,18 +284,18 @@ const getStyles = stylesFactory((theme: GrafanaTheme2, isReversed, hideQuickRang
287284
body: css`
288285
display: flex;
289286
flex-direction: row-reverse;
290-
height: ${isContainerTall ? '381px' : '217px'};
287+
height: ${isContainerTall ? '281px' : '217px'};
291288
`,
292289
leftSide: css`
293290
display: flex;
294291
flex-direction: column;
295292
border-right: ${isReversed ? 'none' : `1px solid ${theme.colors.border.weak}`};
296-
width: ${!hideQuickRanges ? '60%' : '100%'};
293+
width: ${!hideQuickRanges ? '50%' : '100%'};
297294
overflow: hidden;
298295
order: ${isReversed ? 1 : 0};
299296
`,
300297
rightSide: css`
301-
width: ${isFullscreen ? '40%' : '100%'}; !important;
298+
width: ${isFullscreen ? '50%' : '100%'}; !important;
302299
border-right: ${isReversed ? `1px solid ${theme.colors.border.weak}` : 'none'};
303300
display: flex;
304301
flex-direction: column;

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export const TimePickerFooter: FC<Props> = (props) => {
5757
return null;
5858
}
5959

60+
const fnColor = theme.isDark ? '#8EC4AD' : '#3A785E';
61+
6062
return (
6163
<div>
6264
<section
@@ -72,7 +74,15 @@ export const TimePickerFooter: FC<Props> = (props) => {
7274
<TimeZoneOffset timeZone={timeZone} timestamp={timestamp} />
7375
</div>
7476
<div className={style.spacer} />
75-
<Button variant="secondary" onClick={onToggleChangeTimeSettings} size="sm">
77+
<Button
78+
onClick={onToggleChangeTimeSettings}
79+
size="md"
80+
style={{
81+
backgroundColor: '#ffffff00',
82+
color: fnColor,
83+
border: `1px solid ${fnColor}`,
84+
}}
85+
>
7686
<Trans i18nKey="time-picker.footer.change-settings-button">Change time settings</Trans>
7787
</Button>
7888
</section>
@@ -142,6 +152,7 @@ const getStyle = stylesFactory((theme: GrafanaTheme2) => {
142152
flex-direction: row;
143153
justify-content: space-between;
144154
align-items: center;
155+
height: 60px;
145156
`,
146157
editContainer: css`
147158
border-top: 1px solid ${theme.colors.border.weak};

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,15 @@ export const TimeRangeContent = (props: Props) => {
152152
</Field>
153153
{fyTooltip}
154154
</div>
155-
<Button data-testid={selectors.components.TimePicker.applyTimeRange} type="button" onClick={onApply}>
155+
<Button
156+
data-testid={selectors.components.TimePicker.applyTimeRange}
157+
onClick={onApply}
158+
style={{
159+
width: '100%',
160+
textAlign: 'center',
161+
paddingLeft: '55px',
162+
}}
163+
>
156164
<Trans i18nKey="time-picker.range-content.apply-button">Apply time range</Trans>
157165
</Button>
158166

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, { useMemo } from 'react';
33

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

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

88
interface Props {
99
info?: TimeZoneInfo;
@@ -12,12 +12,17 @@ interface Props {
1212
export const TimeZoneDescription = ({ info }: Props) => {
1313
const styles = useStyles2(getStyles);
1414
const description = useDescription(info);
15+
const { isDark } = useTheme2();
1516

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

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

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

0 commit comments

Comments
 (0)