Created
October 21, 2022 08:09
-
-
Save fmg-lydonchandra/4801cb029eeb32e9f12a3acc6785ef5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { React, window } from "https://deno.land/x/[email protected]/mod.ts"; | |
export type Cycle = { | |
id: string; | |
durations?: Record<string, number>; | |
}; | |
const Box = <div></div>; | |
const DetailItem = <div></div>; | |
function renderDetails(cycle: Cycle): any { | |
const bla = Object.entries(cycle.durations); | |
console.log(bla); | |
return Object.entries(cycle.durations) | |
.map(([key, value], idx) => { | |
// console.log(key, value); | |
return (<DetailItem key={key}> | |
<Box className={key.toUpperCase() === "DELAY" ? "isDelay" : ""}>{key}</Box> | |
<Box>{value}</Box> | |
</DetailItem>); | |
}) | |
} | |
const data1: Cycle = { | |
id: "id1", durations: { "Delay": 100, "NotDelay": 0 }, | |
} | |
const fragment = renderDetails(data1); | |
console.log(JSON.stringify(fragment, null, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment