Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 50 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 | translations |
||
11 | name="List" |
||
12 | render={(t, componentLabel) => { |
||
13 | const elementsLabel = t("props", { context: "elements" }); |
||
14 | |||
15 | return ( |
||
16 | <Demo |
||
17 | label={componentLabel} |
||
18 | props={{ |
||
19 | ...DEMO_COMMON_PROPS, |
||
20 | shadow: BooleanProp(false), |
||
21 | [elementsLabel]: NumberProp(3), |
||
22 | }} |
||
23 | rows={[ |
||
24 | ["className", "hide", "dark", "unstyled", "shadow", elementsLabel], |
||
25 | ]} |
||
26 | > |
||
27 | {(props: any) => { |
||
28 | let elements: string[] = []; |
||
29 | for (let i = 0; i < (props[elementsLabel] as number); ++i) { |
||
30 | elements.push( |
||
31 | t("props", { context: "elements_single", index: i + 1 }) |
||
32 | ); |
||
33 | } |
||
34 | |||
35 | return ( |
||
36 | <div className="m-auto flex flex-col items-center text-xl"> |
||
37 | <List elements={elements} {...props} /> |
||
38 | </div> |
||
39 | ); |
||
40 | }} |
||
41 | </Demo> |
||
42 | ); |
||
43 | }} |
||
44 | > |
||
45 | {} |
||
46 | </ComponentPage> |
||
47 | ); |
||
48 | |||
49 | export default ListPage; |
||
50 |