Skip to content

Commit

Permalink
Merge pull request #3 from muhammadsemeer/editor
Browse files Browse the repository at this point in the history
add action to epmty create button
  • Loading branch information
muhammadsemeer authored Oct 23, 2021
2 parents 0638c8a + c784343 commit 7c57e62
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/Empty/Empty.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import React, { FC } from "react";
import React, { FC, useState } from "react";
import { Button, Empty as AntEmpty } from "antd";
import CreateModal from "../CreateModal/CreateModal";

export interface EmptyProps {
height?: number | string;
create?: boolean;
}

const Empty: FC<EmptyProps> = ({ height, create }) => {
const [isModalUp, setModalUp] = useState(false);
return (
<div
className="flex middle"
style={{ height: height ? height : "calc(100vh - 300px)" }}
>
<AntEmpty image={AntEmpty.PRESENTED_IMAGE_SIMPLE}>
{create && <Button type="primary">Create New Instance</Button>}
{create && (
<>
<Button onClick={() => setModalUp(true)} type="primary">Create New Instance</Button>
<CreateModal
visible={isModalUp}
onCancel={() => setModalUp(false)}
/>
</>
)}
</AntEmpty>
</div>
);
Expand Down

0 comments on commit 7c57e62

Please sign in to comment.