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