Skip to content

Commit

Permalink
removed external IProps
Browse files Browse the repository at this point in the history
  • Loading branch information
glowindadark committed Dec 15, 2023
1 parent c2eb282 commit ac4e742
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 71 deletions.
17 changes: 13 additions & 4 deletions src/DateTimeRangePicker/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ import React, {useState} from 'react'
import moment, {Moment} from 'moment'

import './DatePicker.scss'
import IProps from './IProps'
import Month from './Month/Month'
import Header from './Header/Header'
import {TCalendarMode} from './TCalendarMode'
import {YearView} from './YearView/YearView'
import {TCalendarMode} from './TCalendarMode'

const DatePicker: React.FunctionComponent<IProps> = (
interface IProps {
range: boolean,
fromDate?: Moment,
untilDate?: Moment,
initialDate?: Moment
months: number,
onFromDateChanged: (date: Moment | undefined) => void
onUntilDateChanged: (date: Moment | undefined) => void
}

const DatePicker = (
{
range = false,
fromDate,
Expand All @@ -17,7 +26,7 @@ const DatePicker: React.FunctionComponent<IProps> = (
months = 1,
onFromDateChanged,
onUntilDateChanged
}
}: IProps
) => {
const [calendarMode, setCalendarMode] = useState<TCalendarMode>('normal')
const [currentDate, setCurrentDate] = useState<Moment>(fromDate
Expand Down
18 changes: 15 additions & 3 deletions src/DateTimeRangePicker/DatePicker/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import React from 'react'

import IProps from './IProps'
import moment from 'moment'
import {TCalendarMode} from '../TCalendarMode'

const Header: React.FunctionComponent<IProps> = ({
interface IProps {
date: moment.Moment,
months: number,
onNextMonth: () => void,
onPrevMonth: () => void
onNextYear: () => void
onPrevYear: () => void
calendarMode: TCalendarMode
setCalendarMode: (mode: TCalendarMode) => void
}

const Header = ({
date,
months,
onPrevMonth,
Expand All @@ -11,7 +23,7 @@ const Header: React.FunctionComponent<IProps> = ({
setCalendarMode,
onPrevYear,
onNextYear
}) => {
}: IProps) => {
const monthsArray = []
for (let monthIndex = 0; monthIndex < months; monthIndex++) {
monthsArray.push(monthIndex)
Expand Down
15 changes: 0 additions & 15 deletions src/DateTimeRangePicker/DatePicker/Header/IProps.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/DateTimeRangePicker/DatePicker/IProps.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/DateTimeRangePicker/DatePicker/Month/IProps.ts

This file was deleted.

18 changes: 14 additions & 4 deletions src/DateTimeRangePicker/DatePicker/Month/Month.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import React, {ReactElement, useState} from 'react'
import React, {ReactElement} from 'react'
import moment, {Moment} from 'moment'

import IProps from './IProps'
interface IProps {
month: number,
year: number,
fromDate?: Moment,
untilDate?: Moment,
hoverDate?: Moment,
showDaysPreviousMonth: boolean,
showDaysNextMonth: boolean,
onDaySelected: (date: Moment) => void,
onDayHover: (date?: Moment | undefined) => void
}

const Month: React.FunctionComponent<IProps> = (
const Month = (
{
month,
year,
Expand All @@ -14,7 +24,7 @@ const Month: React.FunctionComponent<IProps> = (
showDaysNextMonth,
onDaySelected,
onDayHover
}
}: IProps
) => {
const date = moment(`${month}-${year}`, 'M-YYYY')

Expand Down
15 changes: 11 additions & 4 deletions src/DateTimeRangePicker/DatePicker/YearView/YearView.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import React, {FunctionComponent} from 'react'
import {IProps} from './IProps'
import moment from 'moment/moment'
import React from 'react'
import moment, {Moment} from 'moment/moment'
import {TCalendarMode} from '../TCalendarMode'

export const YearView: FunctionComponent<IProps> = ({isRender, currentDate, setCurrentDate, setCalendarMode}) => {
interface IProps {
isRender: boolean
currentDate: Moment
setCurrentDate: (date: Moment) => void
setCalendarMode: (mode: TCalendarMode) => void
}

export const YearView = ({isRender, currentDate, setCurrentDate, setCalendarMode}: IProps) => {
if (!isRender) {
return null
}
Expand Down
9 changes: 0 additions & 9 deletions src/DateTimeRangePicker/TimePicker/IProps.ts

This file was deleted.

13 changes: 9 additions & 4 deletions src/DateTimeRangePicker/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React, {FunctionComponent, SyntheticEvent, useRef, useState} from 'react'
import React, { SyntheticEvent, useRef, useState} from 'react'
import Cleave from 'cleave.js/react'
import moment from 'moment'
import moment, { Moment } from 'moment'

import IProps from './IProps'
import './TimePicker.scss'

const TimePicker: FunctionComponent<IProps> = ({ step = 15, onTimeChanged, time}) => {
interface IProps {
time?: Moment,
step: number,
onTimeChanged: (time: Moment) => void
}

const TimePicker = ({ step = 15, onTimeChanged, time}: IProps) => {
const [currentValue, setCurrentValue] = useState<string | undefined>(time ? time.format('HH:mm') : undefined)
const [isOpen, setIsOpen] = useState<boolean>(false)
const dropdownRef = useRef<HTMLDivElement | any>()
Expand Down

0 comments on commit ac4e742

Please sign in to comment.