Skip to content

Commit cee8fe5

Browse files
authored
improves docs for inactive actionlist items (#4050)
1 parent a416298 commit cee8fe5

File tree

4 files changed

+67
-58
lines changed

4 files changed

+67
-58
lines changed

src/ActionList/ActionList.docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"name": "inactiveText",
8787
"type": "string",
8888
"defaultValue": "",
89-
"description": "Text describing why the item is inactive. This may be used when an item's usual functionality is unavailable due to a system error such as a database outage."
89+
"description": "Text describing why the item is inactive. This may be used when an item's usual functionality is unavailable due to a system error such as a database outage. \nIf there is a leading visual, the alert icon will replace the leading visual. \n If there is a trailing visual, it will replace the trailing visual.\n If there is no visual passed, it will be shown in the trailing visual slot to preserve left alignment of item content. \nText will appear in a tooltip triggered by the alert icon in ActionList items, but text will appear below the description or title on ActionMenu items."
9090
},
9191
{
9292
"name": "role",

src/ActionList/ActionList.stories.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ LinkItemPlayground.args = {
216216
disabled: false,
217217
role: 'listitem',
218218
id: 'item-1',
219+
inactiveText: '',
219220
leadingVisual: null,
220221
trailingVisual: null,
221222
}
@@ -231,6 +232,11 @@ LinkItemPlayground.argTypes = {
231232
id: {
232233
type: 'string',
233234
},
235+
inactiveText: {
236+
control: {
237+
type: 'text',
238+
},
239+
},
234240
leadingVisual: {
235241
control: {
236242
type: 'select',

src/ActionMenu/ActionMenu.examples.stories.tsx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import {
1313
XIcon,
1414
CheckIcon,
1515
CopyIcon,
16+
ArchiveIcon,
17+
BookIcon,
18+
CommentIcon,
19+
RocketIcon,
20+
WorkflowIcon,
1621
} from '@primer/octicons-react'
1722

1823
export default {
@@ -334,3 +339,58 @@ export const OnRightSide = () => (
334339
</ActionMenu.Overlay>
335340
</ActionMenu>
336341
)
342+
343+
export const OnlyInactiveItems = () => (
344+
<ActionMenu>
345+
<ActionMenu.Button inactive>Open menu</ActionMenu.Button>
346+
<ActionMenu.Overlay width="auto">
347+
<ActionList>
348+
<ActionList.Item onSelect={() => alert('Workflows clicked')} inactiveText="Unavailable due to an outage">
349+
Workflows
350+
<ActionList.LeadingVisual>
351+
<WorkflowIcon />
352+
</ActionList.LeadingVisual>
353+
</ActionList.Item>
354+
<ActionList.Item onSelect={() => alert('Archived items clicked')} inactiveText="Unavailable due to an outage">
355+
Archived items
356+
<ActionList.LeadingVisual>
357+
<ArchiveIcon />
358+
</ActionList.LeadingVisual>
359+
</ActionList.Item>
360+
<ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
361+
Settings
362+
<ActionList.LeadingVisual>
363+
<GearIcon />
364+
</ActionList.LeadingVisual>
365+
</ActionList.LinkItem>
366+
<ActionList.Item onSelect={() => alert('Make a copy clicked')} inactiveText="Unavailable due to an outage">
367+
Make a copy
368+
<ActionList.LeadingVisual>
369+
<CopyIcon />
370+
</ActionList.LeadingVisual>
371+
</ActionList.Item>
372+
<ActionList.Divider />
373+
<ActionList.Group title="Github projects">
374+
<ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
375+
What&apos;s new
376+
<ActionList.LeadingVisual>
377+
<RocketIcon />
378+
</ActionList.LeadingVisual>
379+
</ActionList.LinkItem>
380+
<ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
381+
Give feedback
382+
<ActionList.LeadingVisual>
383+
<CommentIcon />
384+
</ActionList.LeadingVisual>
385+
</ActionList.LinkItem>
386+
<ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
387+
GitHub Docs
388+
<ActionList.LeadingVisual>
389+
<BookIcon />
390+
</ActionList.LeadingVisual>
391+
</ActionList.LinkItem>
392+
</ActionList.Group>
393+
</ActionList>
394+
</ActionMenu.Overlay>
395+
</ActionMenu>
396+
)

src/ActionMenu/ActionMenu.features.stories.tsx

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -177,60 +177,3 @@ export const InactiveItems = () => (
177177
</ActionMenu.Overlay>
178178
</ActionMenu>
179179
)
180-
181-
// TODO: Uncomment this story when we have inactive buttons
182-
//
183-
// export const OnlyInactiveItems = () => (
184-
// <ActionMenu>
185-
// <ActionMenu.Button>Open menu</ActionMenu.Button>
186-
// <ActionMenu.Overlay width="auto">
187-
// <ActionList>
188-
// <ActionList.Item onSelect={() => alert('Workflows clicked')} inactiveText="Unavailable due to an outage">
189-
// Workflows
190-
// <ActionList.LeadingVisual>
191-
// <WorkflowIcon />
192-
// </ActionList.LeadingVisual>
193-
// </ActionList.Item>
194-
// <ActionList.Item onSelect={() => alert('Archived items clicked')} inactiveText="Unavailable due to an outage">
195-
// Archived items
196-
// <ActionList.LeadingVisual>
197-
// <ArchiveIcon />
198-
// </ActionList.LeadingVisual>
199-
// </ActionList.Item>
200-
// <ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
201-
// Settings
202-
// <ActionList.LeadingVisual>
203-
// <GearIcon />
204-
// </ActionList.LeadingVisual>
205-
// </ActionList.LinkItem>
206-
// <ActionList.Item onSelect={() => alert('Make a copy clicked')} inactiveText="Unavailable due to an outage">
207-
// Make a copy
208-
// <ActionList.LeadingVisual>
209-
// <CopyIcon />
210-
// </ActionList.LeadingVisual>
211-
// </ActionList.Item>
212-
// <ActionList.Divider />
213-
// <ActionList.Group title="Github projects">
214-
// <ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
215-
// What&apos;s new
216-
// <ActionList.LeadingVisual>
217-
// <RocketIcon />
218-
// </ActionList.LeadingVisual>
219-
// </ActionList.LinkItem>
220-
// <ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
221-
// Give feedback
222-
// <ActionList.LeadingVisual>
223-
// <CommentIcon />
224-
// </ActionList.LeadingVisual>
225-
// </ActionList.LinkItem>
226-
// <ActionList.LinkItem href="/" inactiveText="Unavailable due to an outage">
227-
// GitHub Docs
228-
// <ActionList.LeadingVisual>
229-
// <BookIcon />
230-
// </ActionList.LeadingVisual>
231-
// </ActionList.LinkItem>
232-
// </ActionList.Group>
233-
// </ActionList>
234-
// </ActionMenu.Overlay>
235-
// </ActionMenu>
236-
// )

0 commit comments

Comments
 (0)