PropertyList with composed React subcomponents implementation

This commit is contained in:
2023-05-23 22:53:43 -05:00
parent dbdbf78522
commit dc1ad36cc9

View File

@@ -0,0 +1,34 @@
import React, { FunctionComponent, ReactNode } from "react";
import Property from "@/components/common/Property";
const PropertyListItem: FunctionComponent<{
title: string;
children: string;
}> = ({ title, children }) => {
return (
<li>
<span title={title}>{children}</span>
</li>
);
};
type PropertyListProps = {
title: string;
children: ReactNode;
};
const PropertyList: FunctionComponent<PropertyListProps> & {
Item: typeof PropertyListItem;
} = ({ title, children }) => {
return (
<Property title={title}>
<ul key={2} className="list-disc">
{children}
</ul>
</Property>
);
};
PropertyList.Item = PropertyListItem;
export default PropertyList;