diff --git a/src/components/EmptyPlaceholder/EmptyPlaceholder.tsx b/src/components/EmptyPlaceholder/EmptyPlaceholder.tsx index f5f82ac..2d54d35 100644 --- a/src/components/EmptyPlaceholder/EmptyPlaceholder.tsx +++ b/src/components/EmptyPlaceholder/EmptyPlaceholder.tsx @@ -1,5 +1,4 @@ -import { Button } from "../Button/Button"; -import "./emptyPlaceholder.css"; +import { Placeholder } from "../Placeholder/Placeholder"; import { EmptyPlaceholderIcon } from "./EmptyPlaceholderIcon"; type Props = { @@ -10,18 +9,11 @@ type Props = { export function EmptyPlaceholder({ title, message, onRetry }: Props) { return ( -
- - {title} -
{message}
- - {onRetry && ( -
+ } + > ); } diff --git a/src/components/Placeholder/Placeholder.tsx b/src/components/Placeholder/Placeholder.tsx new file mode 100644 index 0000000..9add32d --- /dev/null +++ b/src/components/Placeholder/Placeholder.tsx @@ -0,0 +1,35 @@ +import { ReactNode } from "react"; +import { Button } from "../Button/Button"; +import "./placeholder.css"; + +type Props = { + title: string; + message: string; + onRetry?: () => void | Promise; + Icon: ReactNode; + className?: string; +}; + +export function Placeholder({ + title, + message, + Icon, + className = "", + onRetry, +}: Props) { + return ( +
+
{Icon}
+ {title} +
{message}
+ + {onRetry && ( +
+ ); +} diff --git a/src/components/EmptyPlaceholder/emptyPlaceholder.css b/src/components/Placeholder/placeholder.css similarity index 61% rename from src/components/EmptyPlaceholder/emptyPlaceholder.css rename to src/components/Placeholder/placeholder.css index 836241d..d954518 100644 --- a/src/components/EmptyPlaceholder/emptyPlaceholder.css +++ b/src/components/Placeholder/placeholder.css @@ -1,17 +1,17 @@ -.emptyPlaceholder { +.placeholder { text-align: center; } -.emptyPlaceholder-icon { +.placeholder-icon { display: block; margin: auto auto 0.75rem; } -.emptyPlaceholder-title { +.placeholder-title { margin-bottom: 0.25rem; display: inline-block; } -.emptyPlaceholder-button { +.placeholder-button { margin: 0.75rem auto 0; } diff --git a/src/index.ts b/src/index.ts index 17234ac..243b55a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,3 +31,4 @@ export { Page } from "./components/Page/Page"; export { NetworkIndicator } from "./components/NetworkIndicator/NetworkIndicator"; export { Tooltip } from "./components/Tooltip/Tooltip"; export { Collapse } from "./components/Collapse/Collapse"; +export { Placeholder } from "./components/Placeholder/Placeholder";