Skip to content

Instantly share code, notes, and snippets.

@dioxmio
Last active October 15, 2022 16:06
Show Gist options
  • Save dioxmio/2701984b223d460cd9f9847c08e30ce5 to your computer and use it in GitHub Desktop.
Save dioxmio/2701984b223d460cd9f9847c08e30ce5 to your computer and use it in GitHub Desktop.
interface Props {
children: React.ReactNode;
content: React.ReactNode;
footer?: string;
isOpen: boolean;
onClose?: () => void;
title?: string;
}
// ❌ Wide multi purpose Component
function Dialog(props): Props {
return (
<... />
)
}
type AvengerProps = {
description: string;
name: string;
}
// Example of usage. We have a big contract to fill
function ShowAvenger({name, description}: AvengerProps) {
return (
<Dialog
title={name}
content={<AvengerDetails description={description} />}
....
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment