Refactor buttons to buttonspinners, add loading state

This commit is contained in:
Alex Holliday committed 2024-08-29 12:06:37 -07:00
1 parent 54b2da9d3b
commit 49eded1508
1 file changed
+8 -6
@@ -21,6 +21,7 @@ import Breadcrumbs from "../../../Components/Breadcrumbs";
import PulseDot from "../../../Components/Animated/PulseDot"; import PulseDot from "../../../Components/Animated/PulseDot";
import "./index.css"; import "./index.css";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
import ButtonSpinner from "../../../Components/ButtonSpinner";
/** /**
* Parses a URL string and returns a URL object. * Parses a URL string and returns a URL object.
* *
@@ -174,11 +175,9 @@ const Configure = () => {
const parsedUrl = parseUrl(monitor?.url); const parsedUrl = parseUrl(monitor?.url);
const protocol = parsedUrl?.protocol?.replace(":", "") || ""; const protocol = parsedUrl?.protocol?.replace(":", "") || "";
let loading = Object.keys(monitor).length === 0;
return ( return (
<Stack className="configure-monitor" gap={theme.gap.large}> <Stack className="configure-monitor" gap={theme.gap.large}>
{loading ? ( {false ? (
<SkeletonLayout /> <SkeletonLayout />
) : ( ) : (
<> <>
@@ -230,7 +229,8 @@ const Configure = () => {
ml: "auto", ml: "auto",
}} }}
> >
<Button <ButtonSpinner
isLoading={isLoading}
level="tertiary" level="tertiary"
label={monitor?.isActive ? "Pause" : "Resume"} label={monitor?.isActive ? "Pause" : "Resume"}
animate="rotate180" animate="rotate180"
@@ -246,7 +246,8 @@ const Configure = () => {
}} }}
onClick={handlePause} onClick={handlePause}
/> />
<Button <ButtonSpinner
isLoading={isLoading}
level="error" level="error"
label="Remove" label="Remove"
sx={{ sx={{
@@ -373,7 +374,8 @@ const Configure = () => {
</Stack> </Stack>
</Stack> </Stack>
<Stack direction="row" justifyContent="flex-end" mt="auto"> <Stack direction="row" justifyContent="flex-end" mt="auto">
<Button <ButtonSpinner
isLoading={isLoading}
level="primary" level="primary"
label="Save" label="Save"
sx={{ px: theme.gap.large }} sx={{ px: theme.gap.large }}