2020-04-03 22:39:53 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
import Spinner from '@/components/elements/Spinner';
|
2026-10-05 18:10:18 -04:00
|
|
|
import { cn } from '@/lib/cn';
|
2020-04-03 22:39:53 -07:00
|
|
|
|
2022-06-26 15:13:52 -04:00
|
|
|
const InputSpinner = ({ visible, children }: { visible: boolean; children: React.ReactNode }) => (
|
2026-10-05 18:10:18 -04:00
|
|
|
// Hides a native select's arrow behind the spinner.
|
|
|
|
|
<div className={cn('relative', visible && '[&_select]:bg-none')}>
|
|
|
|
|
{visible && (
|
2026-10-08 16:53:20 -04:00
|
|
|
<div className='absolute right-0 h-full flex items-center justify-end pr-3'>
|
|
|
|
|
<Spinner size='small' />
|
2020-04-03 22:39:53 -07:00
|
|
|
</div>
|
2026-10-05 18:10:18 -04:00
|
|
|
)}
|
2020-04-03 22:39:53 -07:00
|
|
|
{children}
|
2026-10-05 18:10:18 -04:00
|
|
|
</div>
|
2020-04-03 22:39:53 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default InputSpinner;
|