1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 07:04:22 +00:00
festa/components/TelegramUser.tsx

28 lines
634 B
TypeScript
Raw Normal View History

2022-05-25 15:50:31 +00:00
import { UserData } from "../utils/telegram";
2022-05-27 00:46:30 +00:00
import { TelegramAvatar } from "./TelegramAvatar";
2022-05-25 15:50:31 +00:00
interface TelegramUserLinkProps {
u: UserData
}
2022-05-27 00:46:30 +00:00
export function TelegramUser({u}: TelegramUserLinkProps) {
2022-05-25 15:50:31 +00:00
if(u.username) return (
<a href={`https://t.me/${u.username}`}>
2022-05-27 00:46:30 +00:00
<TelegramAvatar u={u}/>
2022-05-25 15:50:31 +00:00
{u.username}
</a>
)
else if(u.last_name) return (
<span>
2022-05-27 00:46:30 +00:00
<TelegramAvatar u={u}/>
2022-05-25 15:50:31 +00:00
{u.first_name} {u.last_name}
</span>
)
else return (
<span>
2022-05-27 00:46:30 +00:00
<TelegramAvatar u={u}/>
{u.first_name}
2022-05-25 15:50:31 +00:00
</span>
)
}