- 템플릿 파일첨부 컴포넌트와 FileComponentConfigPanel 실시간 동기화 - FileUpload 위젯에 전역 파일 상태 관리 기능 추가 - 파일 업로드/삭제 시 전역 상태 및 localStorage 동기화 - RealtimePreview에서 전역 상태 우선 읽기 및 파일 개수 표시 - 한컴오피스, Apple iWork 파일 형식 지원 추가 - 파일 뷰어 모달 및 미리보기 기능 구현 - 업로드된 파일 디렉토리 .gitignore 추가
18 lines
536 B
TypeScript
18 lines
536 B
TypeScript
import { clsx, type ClassValue } from "clsx";
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
/**
|
|
* 파일 크기를 사람이 읽기 쉬운 형태로 포맷팅
|
|
*/
|
|
export function formatFileSize(bytes: number): string {
|
|
if (bytes === 0) return '0 Bytes';
|
|
const k = 1024;
|
|
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
}
|