Passed
Push — main ( ba3013...bfeaac )
by Cataldo
57s queued 12s
created

playground/src/pages/List/index.tsx   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 49
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 37
mnd 1
bc 1
fnc 0
dl 0
loc 49
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 10
1
import { DEMO_COMMON_PROPS } from "app/constants/demo-props";
2
3
import { BooleanProp, Demo, NumberProp } from "@cianciarusocataldo/demo-ui";
4
5
import { List } from "modular-ui-preview";
6
import { ComponentPage } from "app/components/ComponentPage";
7
8
const ListPage = () => (
9
  <ComponentPage
10
    name="List"
11
    render={(t) => {
12
      const elementsLabel = t("props", { context: "elements" });
13
14
      return (
15
        <Demo
16
          label="List"
17
          props={{
18
            ...DEMO_COMMON_PROPS,
19
            shadow: BooleanProp(false),
20
            [elementsLabel]: NumberProp(3),
21
          }}
22
          rows={[
23
            ["className", "hide", "dark", "unstyled", "shadow", elementsLabel],
24
          ]}
25
        >
26
          {(props: any) => {
27
            let elements: string[] = [];
28
            for (let i = 0; i < (props[elementsLabel] as number); ++i) {
29
              elements.push(
30
                t("props", { context: "elements_single", index: i + 1 })
31
              );
32
            }
33
34
            return (
35
              <div className="m-auto flex flex-col items-center text-xl">
36
                <List elements={elements} {...props} />
37
              </div>
38
            );
39
          }}
40
        </Demo>
41
      );
42
    }}
43
  >
44
    {}
45
  </ComponentPage>
46
);
47
48
export default ListPage;
49