feat: disable select when loading (#2475)

pull/2598/head^2
Carlos Gabriel 2022-04-25 20:30:15 +02:00 committed by GitHub
parent 95a793dd5a
commit 307b098f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -151,11 +151,28 @@ const AvailabilitySelect = ({
onBlur: Noop;
onChange: (value: AvailabilityOption | null) => void;
}) => {
const { t } = useLocale();
const query = trpc.useQuery(["viewer.availability.list"]);
return (
<QueryCell
query={query}
loading={() => {
return (
<Select
isDisabled
options={[]}
isSearchable={false}
onChange={props.onChange}
classNamePrefix="react-select"
className={classNames(
"react-select-container focus:border-primary-500 focus:ring-primary-500 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm",
className
)}
placeholder={t("loading")}
/>
);
}}
success={({ data }) => {
const options = data.schedules.map((schedule) => ({
value: schedule.id,