Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/components/Notification/Notification.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { LoremIpsum, loremIpsum } from "react-lorem-ipsum";
import { Meta, StoryFn } from "@storybook/react";
import { fn } from "storybook/test";

import { helpersArgTypes } from "../../../.storybook/helpers";
import { Markdown } from "../../cmem";
Expand Down Expand Up @@ -74,3 +75,23 @@ ExampleWithActions.args = {
<Button text="Important" intent="danger" key="b2" />,
],
};

const reviewChanges = fn((event: React.MouseEvent) => event.preventDefault()).mockName("Review changes");

/**
* In a narrow container, a button beside the warning could takes up much of the space for the message.
* Put the action on its own line below the message so the warning can use the full width next to the icon.
*/
export const ActionsInNarrowContainers: StoryFn<typeof Notification> = () => {
const previewStyle = { width: "16rem", maxWidth: "100%" };

return (
<div style={previewStyle}>
<Notification intent="warning" flexWidth>
<LoremIpsum p={1} avgSentencesPerParagraph={2} random={false} />
<Button href="#review-changes" onClick={reviewChanges} text="Review changes" />
</Notification>
</div>
);
};
ActionsInNarrowContainers.parameters = { controls: { disable: true } };
Loading