mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui-components.git
synced 2026-04-28 14:03:09 +00:00
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { PrettyBytes } from "../../utils/bytes";
|
|
import "./spaceAllocation.css";
|
|
import React from "react";
|
|
|
|
type Props = {
|
|
data: {
|
|
title: string;
|
|
percent: number;
|
|
size: number;
|
|
}[];
|
|
};
|
|
|
|
export function SpaceAllocation({ data }: Props) {
|
|
return (
|
|
<>
|
|
<div className="nodeSpaceAllocation-bar">
|
|
{data.map((d, index) => (
|
|
<span
|
|
className={`nodeSpaceAllocation-barItem nodeSpaceAllocation-barQuota nodeSpaceAllocation-quota-${index}`}
|
|
style={{ width: d.percent + "%" }}
|
|
></span>
|
|
))}
|
|
</div>
|
|
|
|
<div className="nodeSpaceAllocation-legend">
|
|
{data.map((d, index) => (
|
|
<div className="nodeSpaceAllocation-legendRow">
|
|
<div className="nodeSpaceAllocation-legendLeft">
|
|
<div
|
|
className={`nodeSpaceAllocation-legendItem nodeSpaceAllocation-quota nodeSpaceAllocation-quota-${index}`}
|
|
></div>
|
|
<span>{d.title}</span>
|
|
</div>
|
|
<small>{PrettyBytes(d.size)}</small>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</>
|
|
);
|
|
}
|