2021-12-09 23:51:30 +00:00
|
|
|
import classNames from "classnames";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { InputHTMLAttributes, ReactNode } from "react";
|
|
|
|
import React, { forwardRef } from "react";
|
2021-09-23 14:08:44 +00:00
|
|
|
|
|
|
|
type Props = InputHTMLAttributes<HTMLInputElement> & {
|
2021-12-09 23:51:30 +00:00
|
|
|
label?: ReactNode;
|
2021-09-23 14:08:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const MinutesField = forwardRef<HTMLInputElement, Props>(({ label, ...rest }, ref) => {
|
|
|
|
return (
|
|
|
|
<div className="block sm:flex">
|
2021-12-09 23:51:30 +00:00
|
|
|
{!!label && (
|
2022-02-09 22:32:31 +00:00
|
|
|
<div className="min-w-48 mb-4 sm:mb-0">
|
2023-01-12 16:57:43 +00:00
|
|
|
<label htmlFor={rest.id} className="flex h-full items-center text-sm font-medium text-gray-700">
|
2021-12-09 23:51:30 +00:00
|
|
|
{label}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-09-23 14:08:44 +00:00
|
|
|
<div className="w-full">
|
2022-07-15 16:39:11 +00:00
|
|
|
<div className="relative rounded-sm">
|
2021-09-23 14:08:44 +00:00
|
|
|
<input
|
|
|
|
{...rest}
|
|
|
|
ref={ref}
|
|
|
|
type="number"
|
2021-12-09 23:51:30 +00:00
|
|
|
className={classNames(
|
2022-07-27 02:24:00 +00:00
|
|
|
"block w-full rounded-sm border-gray-300 pl-2 pr-12 text-sm",
|
2021-12-09 23:51:30 +00:00
|
|
|
rest.className
|
|
|
|
)}
|
2021-09-23 14:08:44 +00:00
|
|
|
/>
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">
|
2022-07-27 02:24:00 +00:00
|
|
|
<span className="text-sm text-gray-500" id="duration">
|
2021-09-23 14:08:44 +00:00
|
|
|
mins
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
MinutesField.displayName = "MinutesField";
|
|
|
|
|
|
|
|
export default MinutesField;
|