[st] feat: WithLoadingButton 컴포넌트 추가
This commit is contained in:
@@ -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 };
|
||||
Reference in New Issue
Block a user