index.tsx 745 B

123456789101112131415161718192021222324
  1. import type { FC } from 'react'
  2. import React from 'react'
  3. type Props = {
  4. loading?: boolean
  5. className?: string
  6. children?: React.ReactNode | string
  7. }
  8. const Spinner: FC<Props> = ({ loading = false, children, className }) => {
  9. return (
  10. <div
  11. className={`inline-block text-gray-200 h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] ${loading ? 'motion-reduce:animate-[spin_1.5s_linear_infinite]' : 'hidden'} ${className ?? ''}`}
  12. role="status"
  13. >
  14. <span
  15. className="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]"
  16. >Loading...</span>
  17. {children}
  18. </div>
  19. )
  20. }
  21. export default Spinner