fix: loading style

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-08-28 19:37:52 +08:00
parent fb4ca52244
commit 61ee2ccb3e
3 changed files with 19 additions and 10 deletions
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><circle cx="12" cy="12" r="9" stroke="#10161F" stroke-width="1.5" opacity=".1"/><path stroke="#10161F" stroke-linecap="round" stroke-width="1.5" d="M12 3a8.958 8.958 0 0 0-6.225 2.5"/></svg>

After

Width:  |  Height:  |  Size: 321 B

+16 -8
View File
@@ -24,10 +24,16 @@ export const LoadingCircle: Component<LoadingCircleProps> = ({
</div>
)
const sizeMap2 = {
small: 30,
medium: 40,
large: 50,
}
const smallIconSizeMap = {
small: 12,
medium: 14,
large: 16,
small: 16,
medium: 18,
large: 24,
}
export const LoadingWithIcon: Component<
LoadingCircleProps & {
@@ -35,7 +41,7 @@ export const LoadingWithIcon: Component<
order?: "loading-first" | "icon-first"
}
> = ({ order = "loading-first", size, className, icon, children }) => {
const rootStyle = { width: sizeMap[size], height: sizeMap[size] }
const rootStyle = { width: sizeMap2[size], height: sizeMap2[size] }
const smallIconStyle = {
height: smallIconSizeMap[size],
@@ -51,7 +57,7 @@ export const LoadingWithIcon: Component<
{cloneElement(icon, {
style: {
...icon.props.style,
fontSize: sizeMap[size],
fontSize: sizeMap2[size],
},
className: cn(icon.props.className),
})}
@@ -80,12 +86,12 @@ export const LoadingWithIcon: Component<
<span
className="block size-full"
style={{
clipPath: `polygon(0% 0%, 0% 100%, ${smallIconSizeMap[size]}px 100%, ${smallIconSizeMap[size]}px ${smallIconSizeMap[size]}px, 100% ${smallIconSizeMap[size]}px, 100% 100%, 100% 100%, 100% 0%)`,
clipPath: `polygon(0% 0%, 0% 100%, calc(100% - ${smallIconSizeMap[size]}) 100%, ${smallIconSizeMap[size]} ${smallIconSizeMap[size]}, 100% calc(100% - ${smallIconSizeMap[size]}), 100% 100%, 100% 100%, 100% 0%)`,
}}
>
<i
className="i-mgc-loading-3-cute-re animate-spin"
style={{ fontSize: sizeMap[size] }}
className="i-mgc-loading-3-cute-li animate-spin"
style={{ fontSize: sizeMap2[size] }}
/>
</span>
<span
@@ -99,6 +105,8 @@ export const LoadingWithIcon: Component<
style: {
...icon.props.style,
fontSize: smallIconSizeMap[size],
width: smallIconSizeMap[size],
height: smallIconSizeMap[size],
},
className: icon.props.className,
})}
@@ -55,9 +55,9 @@ export const TocItem: FC<{
}}
className={cn(
"inline-block h-1.5 rounded-full",
"bg-gray-200 duration-200 hover:!bg-gray-400 group-hover:bg-gray-400/50",
"bg-stone-100 duration-200 hover:!bg-stone-400 group-hover:bg-stone-400/50",
"dark:bg-stone-800 dark:hover:!bg-stone-600 dark:group-hover:bg-stone-600/50",
active && "!bg-gray-400 dark:!bg-stone-600",
active && "!bg-stone-400 dark:!bg-stone-600",
)}
/>
</button>