From 3b20643892b571dfa76a3b3c59a3615e736b7343 Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 23 May 2023 22:54:57 -0500 Subject: [PATCH] AbstractCard for universal card styling, use AbstractCard & PropertyList for DomainCard --- src/components/common/AbstractCard.tsx | 27 ++++++++++++ src/components/lookup/DomainCard.tsx | 59 +++++++++++++------------- 2 files changed, 57 insertions(+), 29 deletions(-) create mode 100644 src/components/common/AbstractCard.tsx diff --git a/src/components/common/AbstractCard.tsx b/src/components/common/AbstractCard.tsx new file mode 100644 index 0000000..dfa71bc --- /dev/null +++ b/src/components/common/AbstractCard.tsx @@ -0,0 +1,27 @@ +import React, { FunctionComponent, ReactNode } from "react"; + +type AbstractCardProps = { + children: ReactNode; + header?: ReactNode; + footer?: ReactNode; +}; + +const AbstractCard: FunctionComponent = ({ + children, + header, + footer, +}) => { + return ( +
+ {header != null ? ( +
{header}
+ ) : null} +
{children}
+ {footer != null ? ( +
{footer}
+ ) : null} +
+ ); +}; + +export default AbstractCard; diff --git a/src/components/lookup/DomainCard.tsx b/src/components/lookup/DomainCard.tsx index 83fc305..381f36d 100644 --- a/src/components/lookup/DomainCard.tsx +++ b/src/components/lookup/DomainCard.tsx @@ -4,6 +4,8 @@ import { rdapStatusInfo } from "@/constants"; import type { Domain } from "@/types"; import Events from "@/components/lookup/Events"; import Property from "@/components/common/Property"; +import PropertyList from "@/components/common/PropertyList"; +import AbstractCard from "@/components/common/AbstractCard"; export type DomainProps = { data: Domain; @@ -11,35 +13,34 @@ export type DomainProps = { const DomainCard: FunctionComponent = ({ data }: DomainProps) => { return ( -
-
- {data.ldhName ?? data.unicodeName} ( - {data.handle}) -
-
-
- {data.unicodeName != undefined ? ( - {data.unicodeName} - ) : null} - - {data.ldhName} - - {data.handle} - - - - -
    - {data.status.map((statusKey, index) => ( -
  • - {statusKey} -
  • - ))} -
-
-
-
-
+ + {data.ldhName ?? data.unicodeName} + ({data.handle}) + + } + > +
+ {data.unicodeName != undefined ? ( + {data.unicodeName} + ) : null} + + {data.ldhName} + + {data.handle} + + + + + {data.status.map((statusKey, index) => ( + + {statusKey} + + ))} + +
+
); };