UNPKG

@roots/bud-dashboard

Version:

bud.js core module

14 lines (13 loc) 1.21 kB
import { jsxs as _jsxs, jsx as _jsx } from "@roots/bud-support/jsx-runtime"; import figures from '@roots/bud-support/figures'; import { size as formatSize } from '@roots/bud-support/human-readable'; import { Box, Text } from '@roots/bud-support/ink'; import isNumber from '@roots/bud-support/isNumber'; const Asset = (asset) => { if (!asset) return null; return (_jsxs(Box, { flexDirection: "row", gap: 1, justifyContent: "space-between", overflowX: "hidden", width: "100%", children: [_jsx(Box, { flexDirection: "row", overflowX: "hidden", children: _jsxs(Text, { dimColor: !asset.emitted, wrap: "truncate-end", children: [` `, !asset.emitted ? figures.circle : figures.circleFilled, ` `, asset.name] }) }), _jsxs(Box, { flexDirection: "row", justifyContent: "flex-end", minWidth: 11, children: [_jsx(Box, { flexDirection: "row", minWidth: 1, children: asset.info?.minimized && (_jsxs(Text, { color: "green", dimColor: !asset.emitted, children: [figures.tick, ` `] })) }), _jsx(Text, { dimColor: true, children: `${isNumber(asset?.size) && asset.size > 0 ? formatSize(asset.size) : `ø`}`.trim() })] })] })); }; export { Asset as default };