diff --git a/src/components/SpaceAllocation/SpaceAllocation.tsx b/src/components/SpaceAllocation/SpaceAllocation.tsx index 29acdf9..684f60f 100644 --- a/src/components/SpaceAllocation/SpaceAllocation.tsx +++ b/src/components/SpaceAllocation/SpaceAllocation.tsx @@ -1,36 +1,41 @@ +import { SimpleText } from "../SimpleText/SimpleText"; import { PrettyBytes } from "../utils/bytes"; import "./spaceAllocation.css"; type Props = { data: { title: string; - percent: number; size: number; }[]; }; export function SpaceAllocation({ data }: Props) { + const total = data.reduce((acc, val) => acc + val.size, 0); + return ( <>
{data.map((d, index) => ( ))}
{data.map((d, index) => ( -
-
-
- {d.title} +
+
+
+ {d.title} + + {PrettyBytes(d.size)} +
- {PrettyBytes(d.size)}
))}
diff --git a/src/components/SpaceAllocation/spaceAllocation.css b/src/components/SpaceAllocation/spaceAllocation.css index 6c94b0a..e425ef1 100644 --- a/src/components/SpaceAllocation/spaceAllocation.css +++ b/src/components/SpaceAllocation/spaceAllocation.css @@ -2,7 +2,7 @@ height: 10px; display: flex; gap: 0.75rem; - margin-bottom: 1.5rem; + margin-bottom: 1rem; } .nodeSpaceAllocation-barQuota { @@ -22,19 +22,21 @@ } .nodeSpaceAllocation-quota-0 { - background-color: var(--codex-color); -} - -.nodeSpaceAllocation-quota-1 { background-color: var(--codex-color-primary); } -.nodeSpaceAllocation-quota-2 { +.nodeSpaceAllocation-quota-1 { background-color: #f9fa93; } +.nodeSpaceAllocation-quota-2 { + background-color: var(--codex-color); +} + .nodeSpaceAllocation-legend { margin-top: 0.75rem; + display: flex; + gap: 0.75rem; } .nodeSpaceAllocation-legendItem { @@ -48,11 +50,11 @@ align-items: center; justify-content: space-between; margin-bottom: 0.75rem; - gap: 0.75rem; + gap: 0.5rem; } -.nodeSpaceAllocation-legendLeft { +.nodeSpaceAllocation-legendItem-text { display: flex; - align-items: center; - gap: 0.75rem; + flex-direction: column; + line-height: 1rem; } diff --git a/stories/SpaceAllocation.stories.ts b/stories/SpaceAllocation.stories.ts index 92890d2..8926980 100644 --- a/stories/SpaceAllocation.stories.ts +++ b/stories/SpaceAllocation.stories.ts @@ -18,18 +18,15 @@ export const Default: Story = { args: { data: [ { - title: "Maximum storage space used by the node", - percent: 60, + title: "Space allocated", size: 10000000, }, { - title: "Amount of storage space currently in use", - percent: 20, + title: "New space allocation", size: 10000000 * 0.2, }, { - title: "Amount of storage space reserved", - percent: 20, + title: "Remaining space", size: 10000000 * 0.2, }, ],