[st] feat: WithLoadingButton 컴포넌트 추가

This commit is contained in:
2026-03-12 16:31:36 +09:00
parent e610b3b8e8
commit 7662e80eba
2 changed files with 33 additions and 9 deletions
@@ -341,15 +341,7 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
onClick={handleDownload}
disabled={!vrfcTrgtSn || isDownloading}
>
{isDownloading ? (
<div className="flex w-[4.8rem] items-center justify-center">
<div className="relative size-[2rem]">
<LoadingWithAnimation color="primary" />
</div>
</div>
) : (
"다운로드"
)}
다운로드
</Button>
</div>
</div>
@@ -0,0 +1,32 @@
import {
Button,
type ButtonProps,
LoadingWithAnimation,
} from "@common/components";
interface WithLoadingButtonProps extends ButtonProps {
isLoading: boolean;
children: React.ReactNode;
}
function WithLoadingButton({
isLoading,
children,
...props
}: WithLoadingButtonProps) {
return (
<Button {...props}>
{isLoading ? (
<div className="flex w-[4.8rem] items-center justify-center">
<div className="relative size-[2rem]">
<LoadingWithAnimation color="primary" />
</div>
</div>
) : (
children
)}
</Button>
);
}
export { WithLoadingButton };