57 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-11-06 02:33:58 +01:00
import { Cell, Row } from "@codex-storage/marketplace-ui-components";
2024-11-27 09:43:03 +01:00
import { Bytes } from "../../utils/bytes";
2024-11-06 02:33:58 +01:00
import "./SlotRow.css";
import { classnames } from "../../utils/classnames";
import { attributes } from "../../utils/attributes";
2024-11-06 21:11:50 +01:00
import SlotIcon from "../../assets/icons/slot.svg?react";
2024-11-06 02:33:58 +01:00
type Props = {
bytes: number;
id: string;
active: boolean;
};
export function SlotRow({ bytes, active, id }: Props) {
// const [className, setClassName] = useState("slot-row--inactive");
// useEffect(() => {
// if (active) {
// setClassName("slot-row--opening");
// setTimeout(() => {
// setClassName("slot-row--active");
// }, 15);
// } else {
// setClassName("slot-row--closing");
// setTimeout(() => {
// setClassName("slot-row--inactive");
// }, 350);
// }
// }, [active]);
return (
<Row
{...attributes({ "aria-expanded": active })}
className={classnames(
["slot-row"],
["slot-row--active", active],
["slot-row--inactive", !active]
)}
cells={[
<Cell>
<span></span>
</Cell>,
<Cell colSpan={6}>
<div className={"row gap"}>
<SlotIcon />
<div>
<b>Slot {id}</b>
2024-11-27 09:43:03 +01:00
<small>{Bytes.pretty(bytes)} allocated for the slot</small>
2024-11-06 02:33:58 +01:00
</div>
</div>
</Cell>,
]}></Row>
);
}