2020-09-03 17:26:36 +00:00
|
|
|
import React from "react";
|
|
|
|
import { AlertVariant, Button } from "@patternfly/react-core";
|
|
|
|
import { Meta } from "@storybook/react";
|
|
|
|
|
|
|
|
import { AlertPanel } from "../components/alert/AlertPanel";
|
|
|
|
import { useAlerts } from "../components/alert/Alerts";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: "Alert Panel",
|
|
|
|
component: AlertPanel,
|
|
|
|
} as Meta;
|
|
|
|
|
|
|
|
export const Api = () => (
|
|
|
|
<AlertPanel
|
|
|
|
alerts={[{ key: 1, message: "Hello", variant: AlertVariant.default }]}
|
|
|
|
onCloseAlert={() => {}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
export const AddAlert = () => {
|
2020-09-15 19:44:28 +00:00
|
|
|
const [add, Alerts] = useAlerts();
|
2020-09-03 17:26:36 +00:00
|
|
|
return (
|
|
|
|
<>
|
2020-09-15 19:44:28 +00:00
|
|
|
<Alerts />
|
2020-09-03 17:26:36 +00:00
|
|
|
<Button onClick={() => add("Hello", AlertVariant.default)}>Add</Button>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|