Skip to content

Instantly share code, notes, and snippets.

@lydonchandra
Created October 21, 2022 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydonchandra/3e005ab529b22fc5a7dc7bbfec4a94bc to your computer and use it in GitHub Desktop.
Save lydonchandra/3e005ab529b22fc5a7dc7bbfec4a94bc to your computer and use it in GitHub Desktop.
import { React, window } from "https://deno.land/x/tsx_static@2.0.3/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