mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-06 21:16:06 -06:00
begin adding URL, link action on AbstractCard
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
import type { FunctionComponent, ReactNode } from "react";
|
||||
import React from "react";
|
||||
import { useBoolean } from "usehooks-ts";
|
||||
import { CodeBracketIcon } from "@heroicons/react/24/solid";
|
||||
import {
|
||||
LinkIcon,
|
||||
CodeBracketIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
|
||||
type AbstractCardProps = {
|
||||
children?: ReactNode;
|
||||
header?: ReactNode;
|
||||
footer?: ReactNode;
|
||||
data?: object;
|
||||
url?: string;
|
||||
};
|
||||
|
||||
const AbstractCard: FunctionComponent<AbstractCardProps> = ({
|
||||
url,
|
||||
children,
|
||||
header,
|
||||
footer,
|
||||
@@ -29,6 +34,11 @@ const AbstractCard: FunctionComponent<AbstractCardProps> = ({
|
||||
onClick={toggleRaw}
|
||||
className="h-6 w-6 cursor-pointer"
|
||||
/>
|
||||
{url != undefined ? (
|
||||
<div className="pr-2">
|
||||
<a href={url} target="_blank" rel="noreferrer">
|
||||
<LinkIcon className="h-5 w-5 mt-1 cursor-pointer" />
|
||||
</a>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -9,12 +9,17 @@ import AbstractCard from "@/components/common/AbstractCard";
|
||||
|
||||
export type DomainProps = {
|
||||
data: Domain;
|
||||
url?: string;
|
||||
};
|
||||
|
||||
const DomainCard: FunctionComponent<DomainProps> = ({ data }: DomainProps) => {
|
||||
const DomainCard: FunctionComponent<DomainProps> = ({
|
||||
data,
|
||||
url,
|
||||
}: DomainProps) => {
|
||||
return (
|
||||
<AbstractCard
|
||||
data={data}
|
||||
url={url}
|
||||
header={
|
||||
<>
|
||||
<span className="font-mono tracking-tighter">DOMAIN</span>
|
||||
|
||||
@@ -17,19 +17,20 @@ export type ParsedGeneric =
|
||||
| IpNetwork;
|
||||
export type ObjectProps = {
|
||||
data: ParsedGeneric;
|
||||
url?: string;
|
||||
};
|
||||
|
||||
const Generic: FunctionComponent<ObjectProps> = ({ data }: ObjectProps) => {
|
||||
const Generic: FunctionComponent<ObjectProps> = ({ data, url }: ObjectProps) => {
|
||||
switch (data.objectClassName) {
|
||||
case "domain":
|
||||
return <DomainCard data={data} />;
|
||||
return <DomainCard url={url} data={data} />;
|
||||
case "autnum":
|
||||
case "entity":
|
||||
case "ip network":
|
||||
case "nameserver":
|
||||
default:
|
||||
return (
|
||||
<AbstractCard>
|
||||
<AbstractCard url={url}>
|
||||
Not implemented. (<pre>{data.objectClassName ?? "null"}</pre>)
|
||||
</AbstractCard>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user