Skip to content

X2-11480 add is fetching state for arrival picker #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/DatePicker/DatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const DatePicker = ({
ranges,
shouldShowRelativeRanges = false,
isFutureDatesAllowed = false,
isFetching = false,
components = {},
getTooltip,
upcomingDates,
Expand Down Expand Up @@ -245,6 +246,7 @@ export const DatePicker = ({
<div className="flex">
{upcomingDates ? (
<UpcomingDatePicker
isLoading={isFetching}
upcomingDates={upcomingDates}
value={value}
onChange={handleDayClick}
Expand Down Expand Up @@ -334,4 +336,5 @@ DatePicker.propTypes = {
getTooltip: PropTypes.func,
locale: PropTypes.string,
timezoneName: PropTypes.string,
isLoading: PropTypes.bool,
};
10 changes: 8 additions & 2 deletions src/components/DatePicker/UpcomingDatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ import clsx from "clsx";
import dayjs from "dayjs";
import PropTypes from "prop-types";
import React from "react";
import { Spinner } from "../Spinner";

export const UpcomingDatePicker = ({ value, upcomingDates, onChange, onMonthChange }) => {
export const UpcomingDatePicker = ({ value, upcomingDates, isLoading, onChange, onMonthChange }) => {
return (
<div className="rounded-l-lg border-r border-gray pt-8">
<p className="mb-2 px-6 text-lg font-bold">Upcoming</p>
{upcomingDates?.length > 0 ? (
{isLoading ? (
<div className="mx-6 mt-5 flex h-full min-w-40 items-center justify-center">
<Spinner />
</div>
) : upcomingDates?.length > 0 ? (
<div className="mt-5">
{upcomingDates?.map((date) => {
const isSameDay = dayjs(date).isSame(dayjs(value), "day");
Expand Down Expand Up @@ -42,6 +47,7 @@ export const UpcomingDatePicker = ({ value, upcomingDates, onChange, onMonthChan
UpcomingDatePicker.propTypes = {
value: PropTypes.objectOf(Date),
upcomingDates: PropTypes.arrayOf(Date).isRequired,
isLoading: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onMonthChange: PropTypes.func.isRequired,
};