LastSignInWrapper.tsx 832 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { ReactNode } from 'react'
  2. import { Badge, cn } from 'ui'
  3. import { LastSignInType, useLastSignIn } from '@/hooks/misc/useLastSignIn'
  4. export function LastSignInWrapper({
  5. children,
  6. type,
  7. }: {
  8. children: ReactNode
  9. type: LastSignInType
  10. }) {
  11. const [lastSignIn] = useLastSignIn()
  12. return (
  13. <div className="flex items-center relative">
  14. {lastSignIn === type && (
  15. <Badge
  16. variant="success"
  17. className="absolute -right-4 -top-3 shadow-sm z-10 bg-brand-400 text-foreground pointer-events-none"
  18. >
  19. Last used
  20. </Badge>
  21. )}
  22. <div
  23. className={cn('w-full', {
  24. 'outline outline-1 outline-offset-4 outline-foreground-lighter/50 rounded-md ':
  25. lastSignIn === type,
  26. })}
  27. >
  28. {children}
  29. </div>
  30. </div>
  31. )
  32. }