import UsageBar from "../resources/usage-bar"; import WidgetIcon from "./widget_icon"; import ResourceValue from "./resource_value"; import ResourceLabel from "./resource_label"; import Raw from "./raw"; export default function SingleResource({ children, key, expanded = false }) { const values = children.filter(child => child.type === ResourceValue); const labels = children.filter(child => child.type === ResourceLabel); return
{children.find(child => child.type === WidgetIcon)}
{values.pop()} {labels.pop()}
{ expanded &&
{values.pop()} {labels.pop()}
} {children.find(child => child.type === UsageBar)}
{children.find(child => child.type === Raw)}
; }