From 89afc610227c10928879e3adfad3b4db22206623 Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:14:18 +0330 Subject: [PATCH] Import source: cshare-app/src/components/StorageBar Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- cshare-app/src/components/StorageBar.jsx | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 cshare-app/src/components/StorageBar.jsx diff --git a/cshare-app/src/components/StorageBar.jsx b/cshare-app/src/components/StorageBar.jsx new file mode 100644 index 0000000..59263aa --- /dev/null +++ b/cshare-app/src/components/StorageBar.jsx @@ -0,0 +1,61 @@ +import { formatFileSize } from '../data/mockData'; + +export function StorageBar({ used, total, byType }) { + const pct = Math.min(100, (used / total) * 100); + + return ( +
+
+ + Storage Used + + 85 ? 'var(--danger)' : 'var(--accent)', + }}> + {formatFileSize(used)} / {formatFileSize(total)} + +
+ + {/* Segmented bar */} +
+ {Object.entries(byType).map(([label, { size, color }]) => { + const segPct = (size / total) * 100; + return segPct > 0 ? ( +
+ ) : null; + })} +
+ + {/* Legend */} +
+ {Object.entries(byType).map(([label, { size, color }]) => ( +
+
+ + {label} {formatFileSize(size)} + +
+ ))} +
+
+ ); +}