From 214d1ce68f80daced611cc10e93a79caa9b0d8f8 Mon Sep 17 00:00:00 2001 From: Edbury Enegren <36284167+edburyenegren-okta@users.noreply.github.com> Date: Thu, 5 Jan 2023 13:59:21 -0800 Subject: [PATCH] feat(odyssey-storybook): remove title prop, add isDismissible variant to Toast --- .../components/odyssey-mui/Toast/Toast.mdx | 14 ++- .../odyssey-mui/Toast/Toast.stories.tsx | 98 ++++++++++++++----- 2 files changed, 83 insertions(+), 29 deletions(-) diff --git a/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.mdx b/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.mdx index f21f016ec2..7eca1f84a6 100644 --- a/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.mdx +++ b/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.mdx @@ -15,12 +15,10 @@ Each Toast is made up of up to three parts: Severity, Title, and Message.
This indicates the toast's status as Info, Success, Warning, or Error.
-
Title (optional)
-
Provides quick context; one line max
-
Message
+
Content
- Supplemental information. Be concise - less than three lines of content - as - your Toast will soon vanish! + Be concise - less than three lines of content - as your Toast will soon + vanish!
@@ -36,6 +34,12 @@ The Toast pen will take care of positioning and layout automatically. Toasts wil If multiple Toasts are triggered in a short time, they will stack in order of appearance. For visual consistency, Toasts will resize to match the largest Toast visible. +### Dismissible + + + + + ## Severity ### Info diff --git a/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.stories.tsx b/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.stories.tsx index dc2a25922f..3b44c53dfa 100644 --- a/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.stories.tsx +++ b/packages/odyssey-storybook/src/components/odyssey-mui/Toast/Toast.stories.tsx @@ -16,6 +16,8 @@ import { Alert, AlertTitle, Button, + CloseIcon, + Link, Snackbar, Stack, } from "@okta/odyssey-react-mui"; @@ -32,11 +34,19 @@ export default { }, }, argTypes: { + action: { + control: "text", + default: null, + }, content: { control: "text", defaultValue: "The mission to Sagitarius A has been scheduled for January 7.", }, + isDismissible: { + control: "boolean", + defaultValue: null, + }, role: { control: "radio", options: ["status", null], @@ -47,10 +57,6 @@ export default { options: ["error", "info", "success", "warning"], defaultValue: "info", }, - title: { - control: "string", - defaultValue: "Moonbase Alpha-6", - }, }, decorators: [MuiThemeDecorator], }; @@ -68,13 +74,34 @@ const DefaultTemplate: Story = (args) => { return ( <> - - - {args.title && {args.title}} - {args.content} + + { + setOpen(false); + }} + variant="floating" + size="s" + > + + + ) + } + > + {args.content} + {args.action && args.action} @@ -84,29 +111,37 @@ const DefaultTemplate: Story = (args) => { const StaticTemplate: Story = (args) => { return ( - - {args.title && {args.title}} - {args.content} + } + > + ) + } + > + {args.content} + {args.action && args.action} ); }; export const Info = DefaultTemplate.bind({}); -Info.args = { - title: null, -}; +Info.args = {}; export const InfoStatic = StaticTemplate.bind({}); -InfoStatic.args = { - title: null, -}; +InfoStatic.args = {}; export const Error = DefaultTemplate.bind({}); Error.args = { content: "Hangar 18 has been compromised.", role: "alert", severity: "error", - title: "Security breach", }; export const ErrorStatic = StaticTemplate.bind({}); @@ -114,7 +149,6 @@ ErrorStatic.args = { content: "Hangar 18 has been compromised.", role: "alert", severity: "error", - title: "Security breach", }; export const Warning = DefaultTemplate.bind({}); @@ -122,7 +156,6 @@ Warning.args = { content: "Severe solar winds detected. Local system flights may be delayed.", role: "status", severity: "warning", - title: "Safety warning", }; export const WarningStatic = StaticTemplate.bind({}); @@ -130,7 +163,6 @@ WarningStatic.args = { content: "Severe solar winds detected. Local system flights may be delayed.", role: "status", severity: "warning", - title: "Safety warning", }; export const Success = DefaultTemplate.bind({}); @@ -138,7 +170,6 @@ Success.args = { content: "Docking completed successfully.", role: "status", severity: "success", - title: null, }; export const SuccessStatic = StaticTemplate.bind({}); @@ -146,5 +177,24 @@ SuccessStatic.args = { content: "Docking completed successfully.", role: "status", severity: "success", - title: null, +}; + +export const Dismissible = DefaultTemplate.bind({}); +Dismissible.args = { + action: ( + + View report + + ), + isDismissible: true, +}; + +export const DismissibleStatic = StaticTemplate.bind({}); +DismissibleStatic.args = { + action: ( + + View report + + ), + isDismissible: true, };