feat: background and speed of entries loading indicator

This commit is contained in:
DIYgod 2024-07-29 19:11:45 +08:00
parent 355a36c152
commit fb63d7d259
No known key found for this signature in database
2 changed files with 8 additions and 7 deletions

View File

@ -4,10 +4,7 @@ import { m } from "framer-motion"
import { useEffect, useRef, useState } from "react"
const softSpringPreset: Spring = {
duration: 0.35,
type: "spring",
stiffness: 120,
damping: 20,
}
interface AnimateChangeInHeightProps {
@ -21,7 +18,7 @@ interface AnimateChangeInHeightProps {
export const AutoResizeHeight: React.FC<AnimateChangeInHeightProps> = ({
children,
className,
duration = 0.6,
duration = 0.35,
spring = false,
}) => {
const containerRef = useRef<HTMLDivElement | null>(null)
@ -47,10 +44,14 @@ export const AutoResizeHeight: React.FC<AnimateChangeInHeightProps> = ({
return (
<m.div
className={cn("overflow-hidden", className)}
style={{ height }}
initial={false}
animate={{ height }}
transition={spring ? softSpringPreset : { duration }}
transition={spring ? {
...softSpringPreset,
duration,
} : {
duration,
}}
>
<div ref={containerRef}>{children}</div>
</m.div>

View File

@ -164,7 +164,7 @@ export function EntryColumn() {
/>
<AutoResizeHeight spring>
{isRefreshing && (
<div className="center h-7 gap-2 bg-theme-accent text-xs text-white">
<div className="center h-7 gap-2 text-xs">
<LoadingCircle size="small" />
Refreshing new entries...
</div>