mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-06 11:40:28 -05:00
28 lines
701 B
TypeScript
28 lines
701 B
TypeScript
'use client';
|
|
|
|
import { ExternalLink } from 'lucide-react';
|
|
import React from 'react';
|
|
|
|
interface IpLinkProps {
|
|
ip: string;
|
|
children?: React.ReactNode;
|
|
className?: string;
|
|
target?: '_blank' | '_self';
|
|
}
|
|
|
|
export function IpLink({ ip, children, className = '', target = '_blank' }: IpLinkProps) {
|
|
const url = `https://ipinfo.io/${ip}`;
|
|
|
|
return (
|
|
<a
|
|
href={url}
|
|
target={target}
|
|
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
className={`text-primary hover:text-primary/80 inline-flex items-center gap-1 font-mono transition-colors hover:underline ${className}`}
|
|
>
|
|
{children || ip}
|
|
<ExternalLink className='h-3 w-3' />
|
|
</a>
|
|
);
|
|
}
|