ファイル
btrc-hub/frontend/src/components/TopNavUser.tsx
T
2026-10-18 00:20:30 +09:00

35 行
938 B
TypeScript

import Separator from '@/components/MenuSeparator'
import PrefetchLink from '@/components/PrefetchLink'
import { cn } from '@/lib/utils'
import { useUITranslation } from '@/lib/useUITranslation'
import type { FC } from 'react'
import type { User } from '@/types'
type Props = { user: User | null,
sp?: boolean }
const TopNavUser: FC<Props> = ({ user, sp }) => {
const { label } = useUITranslation ('shared')
if (!(user))
return
const className = cn ((sp
? 'top-nav-user-mobile w-full min-h-[40px] flex items-center pl-8'
: 'top-nav-user-desktop shrink-0 whitespace-nowrap ml-auto'),
'font-bold text-red-600 hover:text-red-400',
'dark:text-yellow-400 dark:hover:text-yellow-200')
return (
<>
{sp && <Separator/>}
<PrefetchLink to="/users/settings" className={className}>
{user.name || label ('labels.anonymous')}
</PrefetchLink>
</>)
}
export default TopNavUser