File size: 537 Bytes
2f7ab94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

export function getSizeTrans(fs: number): string {
	if (fs < 1024) {
		return String(fs);
	} else if (fs < 1024 * 1024) {
		return parseInt(String((fs * 10) / 1024)) / 10 + " KB";
	} else if (fs < 1024 * 1024 * 1024) {
		return parseInt(String((fs * 10) / 1024 / 1024)) / 10 + " MB";
	} else {
		return parseInt(String((fs * 10) / 1024 / 1024 / 1024)) / 10 + " GB";
	}
}