Skip to content

Commit

Permalink
Implement datepicker with ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Dec 23, 2024
1 parent b78e4ad commit 4afefdf
Show file tree
Hide file tree
Showing 21 changed files with 783 additions and 210 deletions.
58 changes: 58 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .yarn/cache/uplot-npm-1.6.31-416b7ecff6-8a24bed5c5.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
checksumBehavior: update

compressionLevel: mixed

enableGlobalCache: false
Expand Down
1 change: 1 addition & 0 deletions packages/web-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"prop-types": "^15.8.1",
"ramda": "0.27.1",
"react": "17.0.2",
"react-calendar": "^4.0.0",
"react-contextmenu": "2.14.0",
"react-dom": "17.0.2",
"react-highlight-words": "^0.20.0",
Expand Down
34 changes: 34 additions & 0 deletions packages/web-console/src/components/Calendar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react"
import ReactCalendar from "react-calendar"
import type { CalendarProps } from "react-calendar"
import { LooseValue } from "react-calendar/dist/cjs/shared/types"

type Props = {
className?: string
min: Date
max: Date
value: LooseValue | undefined
selectRange: boolean
onChange: (value: CalendarProps["value"]) => void
}

export const Calendar = ({
className,
min,
max,
value,
onChange,
selectRange,
}: Props) => (
<ReactCalendar
className={className}
defaultValue={value}
minDate={min}
maxDate={max}
minDetail="month"
maxDetail="month"
returnValue="start"
onChange={(date) => onChange(date)}
selectRange={selectRange}
/>
)
Loading

0 comments on commit 4afefdf

Please sign in to comment.