Skip to content

Commit 6c9013b

Browse files
committed
version bump
1 parent 5f90043 commit 6c9013b

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.0.91-beta-15",
3+
"version": "0.0.91-beta-16",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/DatePicker/TimeSelect.tsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,20 @@
1515
*/
1616

1717
import ReactSelect from 'react-select'
18-
import { useState } from 'react'
19-
import { DEFAULT_TIME_OPTIONS, DropdownIndicatorTimePicker, updateTime } from './utils'
18+
import { DEFAULT_TIME_OPTIONS, DropdownIndicatorTimePicker, getTimePickerStyles } from './utils'
2019
import { TimeSelectProps } from './types'
2120
import { ReactComponent as ErrorIcon } from '../../../Assets/Icon/ic-warning.svg'
22-
import { DATE_PICKER_IDS, reactSelectStyles } from './constants'
21+
import { DATE_PICKER_IDS } from './constants'
2322

2423
export const TimePickerSelect = ({
2524
disabled = false,
26-
date: dateObject = new Date(),
2725
onChange,
2826
timePickerProps,
2927
error,
30-
default12HourTime,
31-
dataTestIdForTime = DATE_PICKER_IDS.TIME,
28+
selectedTimeOption,
3229
}: TimeSelectProps) => {
33-
const [selectedTimeOption, setSelectedTimeOption] = useState(default12HourTime)
30+
const timeSelectStyles = getTimePickerStyles()
3431

35-
const handleTimeChange = (option) => {
36-
onChange(updateTime(dateObject, option.value))
37-
setSelectedTimeOption(option)
38-
}
3932
return (
4033
<>
4134
<div className="dc__no-shrink">
@@ -50,12 +43,12 @@ export const TimePickerSelect = ({
5043
DropdownIndicator: DropdownIndicatorTimePicker,
5144
}}
5245
isSearchable={false}
53-
styles={reactSelectStyles}
46+
styles={timeSelectStyles}
5447
isDisabled={disabled}
5548
{...timePickerProps}
5649
value={selectedTimeOption}
57-
onChange={handleTimeChange}
58-
data-testid={dataTestIdForTime}
50+
onChange={onChange}
51+
data-testid={DATE_PICKER_IDS.TIME}
5952
/>
6053
</div>
6154
{error && (

src/Shared/Components/DatePicker/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ export interface TimeSelectProps {
9393
* Data test id for time picker
9494
*/
9595
dataTestIdForTime?: string
96+
/**
97+
* To hide time selector
98+
*/
99+
selectedTimeOption: OptionType
96100
}
97101

98102
export interface DateTimePickerProps

0 commit comments

Comments
 (0)