2021-12-09 23:51:30 +00:00
|
|
|
import classNames from "classnames";
|
2021-09-23 14:08:44 +00:00
|
|
|
import React, { forwardRef, InputHTMLAttributes, ReactNode } from "react";
|
|
|
|
|
|
|
|
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">
|
2022-02-09 00:05:13 +00:00
|
|
|
<label htmlFor={rest.id} className="flex h-full items-center text-sm font-medium text-neutral-700">
|
2021-12-09 23:51:30 +00:00
|
|
|
{label}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-09-23 14:08:44 +00:00
|
|
|
<div className="w-full">
|
2021-10-10 09:46:20 +00:00
|
|
|
<div className="relative rounded-sm shadow-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-02-09 22:32:31 +00:00
|
|
|
"focus:border-primary-500 focus:ring-primary-500 block w-full rounded-sm border-gray-300 pl-2 pr-12 sm: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">
|
2021-09-23 14:08:44 +00:00
|
|
|
<span className="text-gray-500 sm:text-sm" id="duration">
|
|
|
|
mins
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
MinutesField.displayName = "MinutesField";
|
|
|
|
|
|
|
|
export default MinutesField;
|