Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 64 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import * as React from "react"; |
||
2 | |||
3 | export interface ContextBlockItemProps { |
||
4 | title?: string; |
||
5 | subtext?: string | React.ReactNode; |
||
6 | active?: boolean; |
||
7 | className?: string; |
||
8 | contextId?: string; |
||
9 | backgroundColor?: string; |
||
10 | backgroundOpacity?: string; |
||
11 | padding?: string; |
||
12 | radius?: string; |
||
13 | fontSize?: string; |
||
14 | fontWeight?: string; |
||
15 | wrapperMargin?: string; |
||
16 | titleMargin?: string; |
||
17 | bodyText?: string | React.ReactNode; |
||
18 | } |
||
19 | |||
20 | const ContextBlockItem: React.FunctionComponent<ContextBlockItemProps> = ({ |
||
21 | subtext, |
||
22 | title, |
||
23 | className, |
||
24 | contextId, |
||
25 | backgroundColor, |
||
26 | backgroundOpacity, |
||
27 | padding, |
||
28 | radius, |
||
29 | fontSize, |
||
30 | fontWeight, |
||
31 | wrapperMargin, |
||
32 | titleMargin, |
||
33 | active, |
||
34 | bodyText, |
||
35 | }): React.ReactElement => { |
||
36 | return ( |
||
37 | <div |
||
38 | className={`${className || ""}${active ? " active" : ""}`} |
||
39 | data-tc-wenv-id={contextId} |
||
40 | data-c-background={ |
||
41 | (backgroundColor && `${backgroundColor}(${backgroundOpacity})`) || |
||
42 | "grey(20)" |
||
43 | } |
||
44 | data-c-padding={padding || "all(normal)"} |
||
45 | data-c-radius={radius || "rounded"} |
||
46 | data-c-margin={wrapperMargin || ""} |
||
47 | > |
||
48 | {title && ( |
||
49 | <p |
||
50 | data-c-font-size={fontSize || "small"} |
||
51 | data-c-margin={titleMargin || "bottom(half)"} |
||
52 | data-c-font-weight={fontWeight || "bold"} |
||
53 | > |
||
54 | {title} |
||
55 | </p> |
||
56 | )} |
||
57 | {subtext && <p data-c-font-size={fontSize || "small"}>{subtext}</p>} |
||
58 | {bodyText && <div>{bodyText}</div>} |
||
59 | </div> |
||
60 | ); |
||
61 | }; |
||
62 | |||
63 | export default ContextBlockItem; |
||
64 |