forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[material-ui][Button] Revert Button loading (mui#44478)"
This reverts commit 232555b.
- Loading branch information
1 parent
4bed60a
commit 9f7b496
Showing
47 changed files
with
862 additions
and
1,587 deletions.
There are no files selected for viewing
7 changes: 3 additions & 4 deletions
7
docs/data/material/components/button-group/LoadingButtonGroup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import * as React from 'react'; | ||
import ButtonGroup from '@mui/material/ButtonGroup'; | ||
import Button from '@mui/material/Button'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
|
||
export default function LoadingButtonGroup() { | ||
return ( | ||
<ButtonGroup variant="outlined" aria-label="Loading button group"> | ||
<Button>Submit</Button> | ||
<LoadingButton>Fetch data</LoadingButton> | ||
<LoadingButton loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
<Button>Fetch data</Button> | ||
<Button loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
Save | ||
</LoadingButton> | ||
</Button> | ||
</ButtonGroup> | ||
); | ||
} |
7 changes: 3 additions & 4 deletions
7
docs/data/material/components/button-group/LoadingButtonGroup.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import * as React from 'react'; | ||
import ButtonGroup from '@mui/material/ButtonGroup'; | ||
import Button from '@mui/material/Button'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
|
||
export default function LoadingButtonGroup() { | ||
return ( | ||
<ButtonGroup variant="outlined" aria-label="Loading button group"> | ||
<Button>Submit</Button> | ||
<LoadingButton>Fetch data</LoadingButton> | ||
<LoadingButton loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
<Button>Fetch data</Button> | ||
<Button loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
Save | ||
</LoadingButton> | ||
</Button> | ||
</ButtonGroup> | ||
); | ||
} |
6 changes: 3 additions & 3 deletions
6
docs/data/material/components/button-group/LoadingButtonGroup.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<ButtonGroup variant="outlined" aria-label="Loading button group"> | ||
<Button>Submit</Button> | ||
<LoadingButton>Fetch data</LoadingButton> | ||
<LoadingButton loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
<Button>Fetch data</Button> | ||
<Button loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
Save | ||
</LoadingButton> | ||
</Button> | ||
</ButtonGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
docs/data/material/components/buttons/IconButtonWithBadge.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@mui/material/styles'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Badge, { badgeClasses } from '@mui/material/Badge'; | ||
import Stack from '@mui/material/Stack'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
import ShoppingCartIcon from '@mui/icons-material/ShoppingCartOutlined'; | ||
|
||
const CartBadge = styled(Badge)` | ||
.${badgeClasses.badge} { | ||
top: -12px; | ||
right: -6px; | ||
} | ||
`; | ||
|
||
export default function IconButtonWithBadge() { | ||
const [loading, setLoading] = React.useState(false); | ||
React.useEffect(() => { | ||
const timeout = setTimeout(() => { | ||
setLoading(false); | ||
}, 2000); | ||
return () => clearTimeout(timeout); | ||
}); | ||
return ( | ||
<Stack spacing={2} direction="row" sx={{ alignItems: 'center' }}> | ||
<IconButton loading> | ||
<Badge badgeContent={4} color="primary"> | ||
<SaveIcon /> | ||
</Badge> | ||
</IconButton> | ||
<IconButton loading={loading} onClick={() => setLoading(true)}> | ||
<ShoppingCartIcon fontSize="small" /> | ||
<CartBadge badgeContent={2} color="primary" overlap="circular" /> | ||
</IconButton> | ||
</Stack> | ||
); | ||
} |
37 changes: 37 additions & 0 deletions
37
docs/data/material/components/buttons/IconButtonWithBadge.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@mui/material/styles'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Badge, { badgeClasses } from '@mui/material/Badge'; | ||
import Stack from '@mui/material/Stack'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
import ShoppingCartIcon from '@mui/icons-material/ShoppingCartOutlined'; | ||
|
||
const CartBadge = styled(Badge)` | ||
.${badgeClasses.badge} { | ||
top: -12px; | ||
right: -6px; | ||
} | ||
`; | ||
|
||
export default function IconButtonWithBadge() { | ||
const [loading, setLoading] = React.useState(false); | ||
React.useEffect(() => { | ||
const timeout = setTimeout(() => { | ||
setLoading(false); | ||
}, 2000); | ||
return () => clearTimeout(timeout); | ||
}); | ||
return ( | ||
<Stack spacing={2} direction="row" sx={{ alignItems: 'center' }}> | ||
<IconButton loading> | ||
<Badge badgeContent={4} color="primary"> | ||
<SaveIcon /> | ||
</Badge> | ||
</IconButton> | ||
<IconButton loading={loading} onClick={() => setLoading(true)}> | ||
<ShoppingCartIcon fontSize="small" /> | ||
<CartBadge badgeContent={2} color="primary" overlap="circular" /> | ||
</IconButton> | ||
</Stack> | ||
); | ||
} |
9 changes: 9 additions & 0 deletions
9
docs/data/material/components/buttons/IconButtonWithBadge.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<IconButton loading> | ||
<Badge badgeContent={4} color="primary"> | ||
<SaveIcon /> | ||
</Badge> | ||
</IconButton> | ||
<IconButton loading={loading} onClick={() => setLoading(true)}> | ||
<ShoppingCartIcon fontSize="small" /> | ||
<CartBadge badgeContent={2} color="primary" overlap="circular" /> | ||
</IconButton> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
import * as React from 'react'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import Button from '@mui/material/Button'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
import Stack from '@mui/material/Stack'; | ||
|
||
export default function LoadingButtons() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<LoadingButton loading variant="outlined"> | ||
Submit | ||
</LoadingButton> | ||
<LoadingButton loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</LoadingButton> | ||
<LoadingButton | ||
<Stack spacing={2}> | ||
<Stack direction="row" spacing={2}> | ||
<Button loading variant="outlined"> | ||
Submit | ||
</Button> | ||
<Button loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</Button> | ||
<Button | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</Button> | ||
</Stack> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</LoadingButton> | ||
Full width | ||
</Button> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="end" | ||
endIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Full width | ||
</Button> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
import * as React from 'react'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import Button from '@mui/material/Button'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
import Stack from '@mui/material/Stack'; | ||
|
||
export default function LoadingButtons() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<LoadingButton loading variant="outlined"> | ||
Submit | ||
</LoadingButton> | ||
<LoadingButton loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</LoadingButton> | ||
<LoadingButton | ||
<Stack spacing={2}> | ||
<Stack direction="row" spacing={2}> | ||
<Button loading variant="outlined"> | ||
Submit | ||
</Button> | ||
<Button loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</Button> | ||
<Button | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</Button> | ||
</Stack> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</LoadingButton> | ||
Full width | ||
</Button> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="end" | ||
endIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Full width | ||
</Button> | ||
</Stack> | ||
); | ||
} |
14 changes: 0 additions & 14 deletions
14
docs/data/material/components/buttons/LoadingButtons.tsx.preview
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.