plebdevs/src/components/zaps/ZapDisplay.js

26 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-04-22 19:09:46 -05:00
import React, { useRef } from 'react';
import { OverlayPanel } from 'primereact/overlaypanel';
import ZapForm from './ZapForm';
2024-04-23 21:30:54 -05:00
import { ProgressSpinner } from 'primereact/progressspinner';
2024-04-22 19:09:46 -05:00
const ZapDisplay = ({ zapAmount, event, zapsLoading }) => {
2024-04-22 19:09:46 -05:00
const op = useRef(null);
return (
<>
<span className="text-xs cursor-pointer flex items-center" onClick={(e) => op.current.toggle(e)}>
2024-07-31 16:41:18 -05:00
<i className="pi pi-bolt text-yellow-300"></i>
{zapsLoading ? (
<ProgressSpinner style={{width: '20px', height: '20px'}} strokeWidth="8" animationDuration=".5s" />
2024-07-31 16:41:18 -05:00
) : (
zapAmount !== null ? zapAmount : <ProgressSpinner style={{width: '20px', height: '20px'}} strokeWidth="8" animationDuration=".5s" />
2024-07-31 16:41:18 -05:00
)}
</span>
<OverlayPanel className='w-[40%] h-[40%]' ref={op}>
2024-04-22 19:09:46 -05:00
<ZapForm event={event} />
</OverlayPanel>
</>
)
}
2024-07-31 16:41:18 -05:00
export default ZapDisplay;