Skip to content

Commit 5387e63

Browse files
committed
Revert "Add loading prop for Button and IconButton (#3582)"
This reverts commit 3be64c5.
1 parent 06f57f4 commit 5387e63

File tree

60 files changed

+292
-1124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+292
-1124
lines changed

.changeset/lazy-jobs-pump.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

e2e/components/Button.test.ts

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -479,148 +479,6 @@ test.describe('Button', () => {
479479
}
480480
})
481481

482-
test.describe('Loading', () => {
483-
for (const theme of themes) {
484-
test.describe(theme, () => {
485-
test('default @vrt', async ({page}) => {
486-
await visit(page, {
487-
id: 'components-button-features--loading',
488-
globals: {
489-
colorScheme: theme,
490-
},
491-
})
492-
493-
// Default state
494-
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(`Button.Loading.${theme}.png`)
495-
})
496-
497-
test('axe @aat', async ({page}) => {
498-
await visit(page, {
499-
id: 'components-button-features--loading',
500-
globals: {
501-
colorScheme: theme,
502-
},
503-
})
504-
await expect(page).toHaveNoViolations({
505-
rules: {
506-
'color-contrast': {
507-
enabled: theme !== 'dark_dimmed',
508-
},
509-
},
510-
})
511-
})
512-
})
513-
}
514-
})
515-
516-
test.describe('Loading Custom Announcement', () => {
517-
for (const theme of themes) {
518-
test.describe(theme, () => {
519-
test('default @vrt', async ({page}) => {
520-
await visit(page, {
521-
id: 'components-button-features--loading-custom-announcement',
522-
globals: {
523-
colorScheme: theme,
524-
},
525-
})
526-
527-
// Default state
528-
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
529-
`Button.Loading Custom Announcement.${theme}.png`,
530-
)
531-
})
532-
533-
test('axe @aat', async ({page}) => {
534-
await visit(page, {
535-
id: 'components-button-features--loading-custom-announcement',
536-
globals: {
537-
colorScheme: theme,
538-
},
539-
})
540-
await expect(page).toHaveNoViolations({
541-
rules: {
542-
'color-contrast': {
543-
enabled: theme !== 'dark_dimmed',
544-
},
545-
},
546-
})
547-
})
548-
})
549-
}
550-
})
551-
552-
test.describe('Loading With Leading Visual', () => {
553-
for (const theme of themes) {
554-
test.describe(theme, () => {
555-
test('default @vrt', async ({page}) => {
556-
await visit(page, {
557-
id: 'components-button-features--loading-with-leading-visual',
558-
globals: {
559-
colorScheme: theme,
560-
},
561-
})
562-
563-
// Default state
564-
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
565-
`Button.Loading With Leading Visual.${theme}.png`,
566-
)
567-
})
568-
569-
test('axe @aat', async ({page}) => {
570-
await visit(page, {
571-
id: 'components-button-features--loading-with-leading-visual',
572-
globals: {
573-
colorScheme: theme,
574-
},
575-
})
576-
await expect(page).toHaveNoViolations({
577-
rules: {
578-
'color-contrast': {
579-
enabled: theme !== 'dark_dimmed',
580-
},
581-
},
582-
})
583-
})
584-
})
585-
}
586-
})
587-
588-
test.describe('Loading With Trailing Visual', () => {
589-
for (const theme of themes) {
590-
test.describe(theme, () => {
591-
test('default @vrt', async ({page}) => {
592-
await visit(page, {
593-
id: 'components-button-features--loading-with-trailing-visual',
594-
globals: {
595-
colorScheme: theme,
596-
},
597-
})
598-
599-
// Default state
600-
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot(
601-
`Button.Loading With Trailing Visual.${theme}.png`,
602-
)
603-
})
604-
605-
test('axe @aat', async ({page}) => {
606-
await visit(page, {
607-
id: 'components-button-features--loading-with-trailing-visual',
608-
globals: {
609-
colorScheme: theme,
610-
},
611-
})
612-
await expect(page).toHaveNoViolations({
613-
rules: {
614-
'color-contrast': {
615-
enabled: theme !== 'dark_dimmed',
616-
},
617-
},
618-
})
619-
})
620-
})
621-
}
622-
})
623-
624482
test.describe('Dev: Invisible Variants', () => {
625483
for (const theme of themes) {
626484
test.describe(theme, () => {

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react/src/Button/Button.docs.json

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@
1818
"description": "For counter buttons, the number to display."
1919
},
2020
{
21-
"name": "inactive",
22-
"type": "boolean",
23-
"description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button.\n This is intended to be used when a system error such as an outage prevents the button from performing its usual action.\n Inactive styles are slightly different from disabled styles because inactive buttons need to have an accessible color contrast ratio. This is because inactive buttons can have tooltips or perform an action such as opening a dialog explaining why it's inactive.\n If both `disabled` and `inactive` are true, `disabled` takes precedence."
21+
"name": "variant",
22+
"type": "'default'\n| 'primary'\n| 'danger'\n| 'invisible'",
23+
"defaultValue": "'default'",
24+
"description": "Change the visual style of the button."
25+
},
26+
{
27+
"name": "size",
28+
"type": "'small'\n| 'medium'\n| 'large'",
29+
"defaultValue": "'medium'"
2430
},
2531
{
2632
"name": "leadingIcon",
@@ -33,22 +39,6 @@
3339
"type": "React.ElementType",
3440
"description": "A visual to display before the button text."
3541
},
36-
{
37-
"name": "loading",
38-
"type": "boolean",
39-
"description": "When true, the button is in a loading state."
40-
},
41-
{
42-
"name": "loadingAnnouncement",
43-
"type": "string",
44-
"description": "The content to announce to screen readers when loading. This requires `loading` prop to be true"
45-
},
46-
47-
{
48-
"name": "size",
49-
"type": "'small'\n| 'medium'\n| 'large'",
50-
"defaultValue": "'medium'"
51-
},
5242
{
5343
"name": "trailingIcon",
5444
"type": "React.ComponentType<OcticonProps>",
@@ -61,10 +51,9 @@
6151
"description": "A visual to display after the button text."
6252
},
6353
{
64-
"name": "variant",
65-
"type": "'default'\n| 'primary'\n| 'danger'\n| 'invisible'",
66-
"defaultValue": "'default'",
67-
"description": "Change the visual style of the button."
54+
"name": "inactive",
55+
"type": "boolean",
56+
"description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button.\n This is intended to be used when a system error such as an outage prevents the button from performing its usual action.\n Inactive styles are slightly different from disabled styles because inactive buttons need to have an accessible color contrast ratio. This is because inactive buttons can have tooltips or perform an action such as opening a dialog explaining why it's inactive.\n If both `disabled` and `inactive` are true, `disabled` takes precedence."
6857
},
6958
{
7059
"name": "as",

packages/react/src/Button/Button.examples.stories.tsx

Lines changed: 0 additions & 78 deletions
This file was deleted.

packages/react/src/Button/Button.features.stories.tsx

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {EyeIcon, TriangleDownIcon, HeartIcon, DownloadIcon} from '@primer/octicons-react'
1+
import {EyeIcon, TriangleDownIcon, HeartIcon} from '@primer/octicons-react'
22
import React, {useState} from 'react'
33
import {Button} from '.'
44

@@ -96,37 +96,3 @@ export const Small = () => <Button size="small">Default</Button>
9696
export const Medium = () => <Button size="medium">Default</Button>
9797

9898
export const Large = () => <Button size="large">Default</Button>
99-
100-
export const Loading = () => <Button loading>Default</Button>
101-
102-
export const LoadingCustomAnnouncement = () => (
103-
<Button loading loadingAnnouncement="This is a custom loading announcement">
104-
Default
105-
</Button>
106-
)
107-
108-
export const LoadingWithLeadingVisual = () => (
109-
<Button loading leadingVisual={DownloadIcon}>
110-
Export
111-
</Button>
112-
)
113-
114-
export const LoadingWithTrailingVisual = () => (
115-
<Button loading trailingVisual={DownloadIcon}>
116-
Export
117-
</Button>
118-
)
119-
120-
export const LoadingTrigger = () => {
121-
const [isLoading, setIsLoading] = useState(false)
122-
123-
const handleClick = () => {
124-
setIsLoading(true)
125-
}
126-
127-
return (
128-
<Button loading={isLoading} onClick={handleClick} leadingVisual={DownloadIcon}>
129-
Export
130-
</Button>
131-
)
132-
}

packages/react/src/Button/Button.stories.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ Playground.argTypes = {
4848
type: 'boolean',
4949
},
5050
},
51-
loading: {
52-
control: {
53-
type: 'boolean',
54-
},
55-
},
56-
count: {
57-
control: {
58-
type: 'number',
59-
},
60-
},
6151
leadingVisual: OcticonArgType([EyeClosedIcon, EyeIcon, SearchIcon, XIcon, HeartIcon]),
6252
trailingVisual: OcticonArgType([EyeClosedIcon, EyeIcon, SearchIcon, XIcon, HeartIcon]),
6353
trailingAction: OcticonArgType([TriangleDownIcon]),
@@ -69,7 +59,6 @@ Playground.args = {
6959
inactive: false,
7060
variant: 'default',
7161
alignContent: 'center',
72-
loading: false,
7362
trailingVisual: null,
7463
leadingVisual: null,
7564
trailingAction: null,

0 commit comments

Comments
 (0)