From e1494e74ae9cf7a00e6b2a386a18f3a5c36edb93 Mon Sep 17 00:00:00 2001 From: Armagan Ersoz Date: Thu, 17 Nov 2022 14:59:55 +1000 Subject: [PATCH] update stories --- src/PageHeader/PageHeader.stories.tsx | 130 +++++++++++++++++++++----- src/PageHeader/PageHeader.tsx | 13 +-- 2 files changed, 109 insertions(+), 34 deletions(-) diff --git a/src/PageHeader/PageHeader.stories.tsx b/src/PageHeader/PageHeader.stories.tsx index 5f6cfa67f4e..ccba218500d 100644 --- a/src/PageHeader/PageHeader.stories.tsx +++ b/src/PageHeader/PageHeader.stories.tsx @@ -20,7 +20,6 @@ import {OcticonArgType} from '../utils/story-helpers' import {PageHeader} from './PageHeader' import Hidden from '../Hidden' -import {Actions} from '../drafts/MarkdownEditor/Actions' const meta: Meta = { title: 'Drafts/Components/PageHeader', @@ -29,12 +28,12 @@ const meta: Meta = { controls: {expanded: true} }, args: { - isContextAreaVisible: true, + 'ContextArea.hidden': false, ParentLink: 'Previous Page', 'ParentLink.hidden': false, 'ContextBar.hidden': true, 'ContextAreaAction.hidden': true, - 'BackButton.hidden': true, + 'BackButton.hidden': false, Title: 'Branches', 'Title.as': 'h2', 'Title.variant': 'medium', @@ -42,19 +41,33 @@ const meta: Meta = { 'LeadingVisual.hidden': false, 'TrailingVisual.hidden': false, 'TrailingAction.hidden': false, + 'Actions.hidden': false, 'Description.hidden': false, 'Navigation.hidden': false }, argTypes: { - isContextAreaVisible: { + 'ContextArea.hidden': { type: 'boolean', table: { - category: 'ContextArea Slot' - } + category: 'ContextArea Slot', + type: {summary: 'string'}, + defaultValue: { + summary: ` + { + narrow: false, + regular: true, + wide: true + } + ` + } + }, + description: + 'ContextArea is only visible on narrow viewports by default to provide user context of where they are at their journey.', + defaultValue: {summary: 'hidden', detail: 'narrow', another: 'false'} }, ParentLink: { type: 'string', - if: {arg: 'isContextAreaVisible'}, + if: {arg: 'ContextArea.hidden', truthy: false}, table: { category: 'ContextArea Slot' }, @@ -62,32 +75,68 @@ const meta: Meta = { }, 'ParentLink.hidden': { type: 'boolean', - if: {arg: 'isContextAreaVisible'}, + if: {arg: 'ContextArea.hidden', truthy: false}, table: { - category: 'ContextArea Slot' + category: 'ContextArea Slot', + defaultValue: { + summary: ` + { + narrow: false, + regular: true, + wide: true + } + ` + } }, description: 'Parent ' }, 'ContextBar.hidden': { type: 'boolean', - if: {arg: 'isContextAreaVisible'}, + if: {arg: 'ContextArea.hidden', truthy: false}, table: { - category: 'ContextArea Slot' + category: 'ContextArea Slot', + defaultValue: { + summary: ` + { + narrow: false, + regular: true, + wide: true + } + ` + } }, description: 'ContextBar is generic slot for any component above the title region. Use it for custom breadcrumbs and other navigation elements instead of ParentLink.' }, 'ContextAreaAction.hidden': { type: 'boolean', - if: {arg: 'isContextAreaVisible'}, + if: {arg: 'ContextArea.hidden', truthy: false}, table: { - category: 'ContextArea Slot' + category: 'ContextArea Slot', + defaultValue: { + summary: ` + { + narrow: false, + regular: true, + wide: true + } + ` + } } }, 'BackButton.hidden': { type: 'boolean', table: { - category: 'TitleArea Slot' + category: 'TitleArea Slot', + defaultValue: { + summary: ` + { + narrow: true, + regular: false, + wide: false + } + ` + } }, description: 'A back button can be used as a leading action for local navigation. On Narrow viewports, use parentLink instead.' @@ -113,27 +162,55 @@ const meta: Meta = { }, options: ['large', 'medium', 'subtitle'], table: { - category: 'TitleArea Slot' + category: 'TitleArea Slot', + defaultValue: { + summary: ` + { + narrow: 'medium', + regular: 'large', + wide: 'large' + } ` + } }, description: '`medium` is the most common page title size. Use for static titles in most situations. `large` for for user-generated content such as issues, pull requests, or discussions. `subtitle` when a PageHeader.Title is already present in the page, such as in a SplitPageLayout.' }, LeadingVisual: { ...OcticonArgType([CodeIcon, GitPullRequestIcon, PeopleIcon]), - table: {category: 'TitleArea Slot'}, + table: { + category: 'TitleArea Slot' + }, description: 'Leading visualLeading visuals are optional and appear at the start of the title. They can be octicons, avatars, and other custom visuals that fit a small area.' }, 'LeadingVisual.hidden': { type: 'boolean', table: { - category: 'TitleArea Slot' + category: 'TitleArea Slot', + defaultValue: { + summary: ` + { + narrow: false, + regular: false, + wide: false + } + ` + } } }, 'TrailingVisual.hidden': { type: 'boolean', table: { - category: 'TitleArea Slot' + category: 'TitleArea Slot', + defaultValue: { + summary: ` + { + narrow: false, + regular: false, + wide: false + } + ` + } }, description: 'Trailing visualTrailing visual and trailing text can display auxiliary information. They are placed at the right of the item, and can denote status, privacy details, etc.' @@ -141,7 +218,16 @@ const meta: Meta = { 'TrailingAction.hidden': { type: 'boolean', table: { - category: 'TitleArea Slot' + category: 'TitleArea Slot', + defaultValue: { + summary: ` + { + narrow: true, + regular: false, + wide: false + } + ` + } } }, 'Actions.hidden': { @@ -189,9 +275,9 @@ const Template: Story = args => (