From 6ef6140b29c46dc4be1c58fca6fe6d1507b7a0cc Mon Sep 17 00:00:00 2001 From: Danielle Flinn <43477473+danielleflinn@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:46:44 -0700 Subject: [PATCH] Storybook docs (#5552) * updated sort order * Update preview.tsx * Create avatar.mdx Added avatar documentation based on Figma docs * Added badge docs * fixed typos * added breadcrumb docs * Added callout docs * added color password docs * Added dialog docs * fixed typo * Updated Dialogs docs Added a dialogs.mdx page for general docs that apply to both main Dialogs and Simple Dialogs. Updated the sub-docs pages * Update simple-dialog.mdx * Added documentation from Figma to Forms docs * Create icon-button.mdx * added link docs * Added menu docs * Added progress indicator docs * Updated table docs * Added tab docs * Added toggle group docs * Revert "Update preview.tsx" This reverts commit 4671d9726a6cea031eb5e41f955681cfe25775fc. * added docs for appA11yTitle * Fixed typos * Update libs/components/src/link/link.mdx Co-authored-by: Oscar Hinton * Update libs/components/src/menu/menu.mdx Co-authored-by: Oscar Hinton * Addressed feedback * Addressed feedback on callout, menu, and progress * moved stories mdx files to proper location * Addressed feedback on dialogs.mdx * Update libs/components/src/tabs/tabs.mdx Co-authored-by: Oscar Hinton * Addressed feedback on Tabs * ran prettier * Fixed title formatting * ran prettier * Update libs/components/src/dialog/dialogs.mdx Co-authored-by: Oscar Hinton * ran prettier --------- Co-authored-by: Oscar Hinton --- .storybook/preview.tsx | 1 + libs/components/src/avatar/avatar.mdx | 67 +++++++ libs/components/src/badge/badge.mdx | 67 +++++++ libs/components/src/banner/banner.mdx | 2 +- .../src/breadcrumbs/breadcrumbs.mdx | 54 ++++++ libs/components/src/button/button.mdx | 61 +++--- libs/components/src/callout/callout.mdx | 66 +++++++ .../src/color-password/color-password.mdx | 34 ++++ libs/components/src/dialog/dialog/dialog.mdx | 73 +++++++ libs/components/src/dialog/dialogs.mdx | 56 ++++++ .../dialog/simple-dialog/simple-dialog.mdx | 47 +++++ libs/components/src/form/forms.mdx | 178 ++++++++++++++++++ .../src/icon-button/icon-button.mdx | 55 ++++++ .../src/{stories => input}/input.mdx | 2 +- libs/components/src/link/link.mdx | 39 ++++ libs/components/src/menu/menu.mdx | 21 +++ libs/components/src/progress/progress.mdx | 48 +++++ libs/components/src/stories/forms.mdx | 51 ----- libs/components/src/table/table.mdx | 17 +- libs/components/src/tabs/tabs.mdx | 40 ++++ .../src/toggle-group/toggle-group.mdx | 36 ++++ 21 files changed, 936 insertions(+), 79 deletions(-) create mode 100644 libs/components/src/avatar/avatar.mdx create mode 100644 libs/components/src/badge/badge.mdx create mode 100644 libs/components/src/breadcrumbs/breadcrumbs.mdx create mode 100644 libs/components/src/callout/callout.mdx create mode 100644 libs/components/src/color-password/color-password.mdx create mode 100644 libs/components/src/dialog/dialog/dialog.mdx create mode 100644 libs/components/src/dialog/dialogs.mdx create mode 100644 libs/components/src/dialog/simple-dialog/simple-dialog.mdx create mode 100644 libs/components/src/form/forms.mdx create mode 100644 libs/components/src/icon-button/icon-button.mdx rename libs/components/src/{stories => input}/input.mdx (95%) create mode 100644 libs/components/src/link/link.mdx create mode 100644 libs/components/src/menu/menu.mdx create mode 100644 libs/components/src/progress/progress.mdx delete mode 100644 libs/components/src/stories/forms.mdx create mode 100644 libs/components/src/tabs/tabs.mdx create mode 100644 libs/components/src/toggle-group/toggle-group.mdx diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index d7d37a71e7..0bc9fc5bac 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -101,6 +101,7 @@ const preview: Preview = { }, options: { storySort: { + method: "alphabetical", order: ["Documentation", ["Introduction", "Colors", "Icons"], "Component Library"], }, }, diff --git a/libs/components/src/avatar/avatar.mdx b/libs/components/src/avatar/avatar.mdx new file mode 100644 index 0000000000..c6c5ff78ba --- /dev/null +++ b/libs/components/src/avatar/avatar.mdx @@ -0,0 +1,67 @@ +import { Meta, Story, Primary, Controls } from "@storybook/addon-docs"; + +import * as stories from "./avatar.stories"; + + + +# Avatar + +Avatars display a unique color that helps a user visually recognize their logged in account. + +A variance in color across the avatar component is important as it is used in Account Switching as a +visual indicator to recognize which of a personal or work account a user is logged into. + + + + +## Size + +### Large: 64px + + + +### Default: 48px + + + +### Small 28px + + + +## Background color + +The Background color can be set 3 ways. The color is generated using the following order of +priority: + +- Color +- ID +- Text, usually set to the user's Name field + + +Use the user 'ID' field if `Name` is not defined. + + +## Outline + +If the avatar is displayed on one of the theme's `background` color variables or is interactive, +display the avatar with a 1 pixel `secondary-500` border to meet WCAG AA graphic contrast guidelines +for interactive elements. + + + +## Avatar as a button + +The Avatar can be used as a button. + +Typically this is only in the navigation on client apps where account switching is used and in the +web app for the account menu indicator. + +When the avatar is used as a button, the following states should be used: + +`TODO:` [Jira add stories](https://bitwarden.atlassian.net/browse/CL-101) for button avatars. +[See Figma](https://www.figma.com/file/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library?type=design&node-id=9730-31746&mode=design&t=IjDIHDb6FZl6bUQW-4) + +## Accessibility + +Avatar background color should have 3.1:1 contrast with it’s background; or include the +`secondary-500` border Avatar text should have 4.5:1 contrast with the avatar background color diff --git a/libs/components/src/badge/badge.mdx b/libs/components/src/badge/badge.mdx new file mode 100644 index 0000000000..1c91944997 --- /dev/null +++ b/libs/components/src/badge/badge.mdx @@ -0,0 +1,67 @@ +import { Meta, Story, Primary, Controls } from "@storybook/addon-docs"; + +import * as stories from "./badge.stories"; + + + +# Badge + +The Badge directive can be used on a `` (non clickable events), or an `` or `