summaryrefslogtreecommitdiffstats
path: root/src/pages/index.tsx
blob: d64f9e17dfe7a4d1256457c36d29ee43955cc182 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { For } from "solid-js";
import { createAsync } from "@solidjs/router";

import Button from "@/components/Button";
import Timer from "@/components/Timer";
import { getButtons, getTimers } from "@/helpers/api";
import styles from "./index.module.css";

export default function Home() {
  const btns = createAsync(getButtons);
  const timers = createAsync(getTimers);

  return (
    <>
      <div
        class={styles.btnsCont}
        style={{ "--rows-count": Math.floor(btns()?.length / 2) }}
      >
        <For each={btns()}>{(btn) => <Button {...btn} />}</For>
      </div>
      <div class={styles.timersCont}>
        <For each={timers()}>
          {(timer) => (
            <>
              <hr />
              <Timer {...timer} />
            </>
          )}
        </For>
      </div>
    </>
  );
}