diff --git a/src/components/DomainCard.tsx b/src/components/DomainCard.tsx index 225aca5..f642682 100644 --- a/src/components/DomainCard.tsx +++ b/src/components/DomainCard.tsx @@ -1,47 +1,39 @@ -import type {FunctionComponent, ReactNode} from "react"; -import React, {Fragment} from "react"; +import type {FunctionComponent} from "react"; +import React from "react"; import {rdapStatusInfo} from "@/constants"; -import type {Domain} from "@/schema"; +import type {Domain} from "@/types"; import Events from "@/components/Events" +import Property from "@/components/Property"; export type DomainProps = { data: Domain; }; const DomainCard: FunctionComponent = ({data}: DomainProps) => { - const properties: [string | ReactNode, string | ReactNode][] = []; - - if (data.unicodeName) { - properties.push(["Name", data.unicodeName]); - properties.push(["ASCII Name", data.ldhName]); - } else { - properties.push(["Name", data.ldhName]) - } - - properties.push(["Handle", data.handle]); - properties.push(["Events", ]) - - properties.push([ - "Status", - - ]) return
{data.ldhName ?? data.unicodeName} ({data.handle})
- { - properties.map(([name, value], index) => { - return -
{name}:
-
{value}
-
- } - )} + {data.unicodeName != undefined ? + {data.unicodeName} + : null} + + {data.ldhName} + + + {data.handle} + + + + + +
    + {data.status.map((statusKey, index) => +
  • + {statusKey} +
  • )} +
+
diff --git a/src/components/Property.tsx b/src/components/Property.tsx new file mode 100644 index 0000000..678c148 --- /dev/null +++ b/src/components/Property.tsx @@ -0,0 +1,19 @@ +import type {FunctionComponent, ReactFragment, ReactNode} from "react"; +import React from "react"; +import {classNames} from "@/helpers"; + +type PropertyProps = { + title: string | ReactNode | ReactFragment; + children: string | ReactNode | ReactFragment; + titleClass?: string; + valueClass?: string; +}; + +const Property: FunctionComponent = ({title, children, titleClass, valueClass}) => { + return <> +
{title}:
+
{children}
+ +} + +export default Property; \ No newline at end of file