1
1
import type { StateSlotDetail } from '@/ncoverlay/state'
2
2
3
- import { cn , Skeleton } from '@nextui-org/react'
3
+ import { Skeleton } from '@nextui-org/react'
4
4
import { PlayIcon , MessageSquareTextIcon } from 'lucide-react'
5
5
6
6
export type CountsProps = {
7
+ status : StateSlotDetail [ 'status' ]
7
8
infoCount : StateSlotDetail [ 'info' ] [ 'count' ]
8
9
isSearch ?: boolean
9
10
}
10
11
11
- export const Counts : React . FC < CountsProps > = ( { infoCount, isSearch } ) => {
12
+ export const Counts : React . FC < CountsProps > = ( {
13
+ status,
14
+ infoCount,
15
+ isSearch,
16
+ } ) => {
12
17
return (
13
18
< div className = "flex flex-row items-center gap-4" >
14
19
{ /* 再生数 */ }
15
20
{ 'view' in infoCount && (
16
21
< div className = "flex h-full flex-row items-center gap-1" >
17
22
< PlayIcon className = { isSearch ? 'size-mini' : 'size-tiny' } />
23
+
18
24
< span className = { isSearch ? 'text-mini' : 'text-tiny' } >
19
25
{ infoCount . view . toLocaleString ( 'ja-JP' ) }
20
26
</ span >
@@ -26,13 +32,16 @@ export const Counts: React.FC<CountsProps> = ({ infoCount, isSearch }) => {
26
32
< MessageSquareTextIcon
27
33
className = { isSearch ? 'size-mini' : 'size-tiny' }
28
34
/>
29
- < span className = { isSearch ? 'text-mini' : 'text-tiny' } >
30
- { infoCount . comment ? (
31
- infoCount . comment . toLocaleString ( 'ja-JP' )
32
- ) : (
33
- < Skeleton className = { cn ( 'w-16' , isSearch ? 'h-mini' : 'h-tiny' ) } />
34
- ) }
35
- </ span >
35
+
36
+ < Skeleton
37
+ classNames = { {
38
+ base : [ 'min-w-12 data-[loaded=true]:min-w-0' , 'rounded-[4px]' ] ,
39
+ content : [ isSearch ? 'text-mini' : 'text-tiny' ] ,
40
+ } }
41
+ isLoaded = { 0 < infoCount . comment || status === 'ready' }
42
+ >
43
+ { infoCount . comment . toLocaleString ( 'ja-JP' ) }
44
+ </ Skeleton >
36
45
</ div >
37
46
</ div >
38
47
)
0 commit comments