mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 04:14:18 +00:00
✨ feat: Loading Common
This commit is contained in:
parent
943c739143
commit
1cc64c6fd0
@ -0,0 +1,31 @@
|
|||||||
|
@import '../../../styles/utilities';
|
||||||
|
|
||||||
|
.loadingCommon:empty {
|
||||||
|
@apply bg-white;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: .7rem solid var(--primary-lightest);
|
||||||
|
border-top: .7rem solid var(--primary);
|
||||||
|
animation: spin 2s linear infinite;
|
||||||
|
margin: auto;
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
height: 5rem;
|
||||||
|
width: 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.default {
|
||||||
|
height: 7rem;
|
||||||
|
width: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.large {
|
||||||
|
height: 10rem;
|
||||||
|
width: 10rem;
|
||||||
|
}
|
||||||
|
}
|
26
src/components/common/LoadingCommon/LoadingCommon.tsx
Normal file
26
src/components/common/LoadingCommon/LoadingCommon.tsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import classNames from "classnames";
|
||||||
|
import React from "react";
|
||||||
|
import s from './LoadingCommon.module.scss'
|
||||||
|
|
||||||
|
interface LoadingCommonProps {
|
||||||
|
visible: boolean
|
||||||
|
size?: "small" | "default" | "large",
|
||||||
|
children? : React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LoadingCommon = ({ visible, size="default", children }: LoadingCommonProps) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
visible && <div className={classNames(s.loadingCommon, {
|
||||||
|
[s[size]]: size
|
||||||
|
})}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LoadingCommon
|
Loading…
x
Reference in New Issue
Block a user