@monolith-forensics/monolith-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,153 @@
1
+ import { useTheme } from "@mui/material";
2
+ import moment from "moment";
3
+ import styled from "@emotion/styled";
4
+ import ItemChip from "../../../../components/ItemChip";
5
+ import OpenInFullOutlinedIcon from "@mui/icons-material/OpenInFullOutlined";
6
+
7
+ const placeHolderData = [
8
+ {
9
+ id: 1,
10
+ title: "Intake",
11
+ timestamp: "2021-01-01T12:05:22.000Z",
12
+ description: "This is the description of the acquisition",
13
+ tag: "acquisition",
14
+ color: "#FF0000",
15
+ },
16
+ {
17
+ id: 2,
18
+ title: "Move",
19
+ timestamp: "2021-01-01T14:05:22.000Z",
20
+ description: "This is the description of the acquisition",
21
+ tag: "acquisition",
22
+ color: "#FF0000",
23
+ },
24
+ {
25
+ id: 3,
26
+ title: "Release",
27
+ timestamp: "2021-01-01T18:05:22.000Z",
28
+ description: "This is the description of the acquisition",
29
+ tag: "acquisition",
30
+ color: "#FF0000",
31
+ },
32
+ ];
33
+
34
+ const Timeline = styled(({ className, data = placeHolderData }) => {
35
+ return (
36
+ <>
37
+ <div className={className}>
38
+ {data.map((item, index) => {
39
+ const isLastItem = index === data.length - 1;
40
+ return (
41
+ <TimelineItem key={item.id} data={item} showLine={!isLastItem} />
42
+ );
43
+ })}
44
+ </div>
45
+ </>
46
+ );
47
+ })``;
48
+
49
+ const TimelineItem = styled(({ className, data, showLine = true }) => {
50
+ const theme = useTheme();
51
+ return (
52
+ <div className={className}>
53
+ <div className={"timeline-item-spine"}>
54
+ <Node icon={data.icon} />
55
+ {showLine && <Line />}
56
+ </div>
57
+ <div className={"timeline-item-content"}>
58
+ {data.title && (
59
+ <div className={"timeline-item-content-title"}>{data.title}</div>
60
+ )}
61
+ {data.description && (
62
+ <div className={"timeline-item-content-description"}>
63
+ {data.description}
64
+ </div>
65
+ )}
66
+ {data.timestamp && (
67
+ <div className={"timeline-item-content-timestamp"}>
68
+ <ItemChip
69
+ text={moment(data.timestamp).format("MMM DD, YYYY hh:mm A")}
70
+ style={{ backgroundColor: theme.palette.action.hover }}
71
+ />
72
+ </div>
73
+ )}
74
+ {data.detailsComponent && data.detailsComponent}
75
+ </div>
76
+ </div>
77
+ );
78
+ })`
79
+ display: flex;
80
+ .timeline-item-content {
81
+ margin-left: 20px;
82
+ .timeline-item-content-title {
83
+ font-size: 16px;
84
+ font-weight: bold;
85
+ margin-bottom: 10px;
86
+ color: ${(props) => props.theme.palette.text.primary};
87
+ }
88
+ .timeline-item-content-description {
89
+ margin-bottom: 10px;
90
+ color: ${(props) => props.theme.palette.text.secondary};
91
+ }
92
+ .timeline-item-content-timestamp {
93
+ margin-bottom: 10px;
94
+ color: ${(props) => props.theme.palette.divider};
95
+ }
96
+ }
97
+ .timeline-item-spine {
98
+ // outline: 1px solid ${(props) => props.theme.palette.divider};
99
+ width: 20px;
100
+ height: 100%;
101
+ display: flex;
102
+ flex-direction: column;
103
+ align-items: center;
104
+ justify-content: center;
105
+ }
106
+ `;
107
+
108
+ const Node = styled(
109
+ ({
110
+ className,
111
+ icon = <OpenInFullOutlinedIcon style={{ fontSize: 12 }} />,
112
+ }) => {
113
+ return (
114
+ <div className={className}>
115
+ <div className="node-bullet">
116
+ <div className="node-bullet-icon">{icon}</div>
117
+ </div>
118
+ </div>
119
+ );
120
+ }
121
+ )`
122
+ .node-bullet {
123
+ position: relative;
124
+ width: 25px;
125
+ height: 25px;
126
+ border-radius: 50%;
127
+ background-color: ${(props) => props.theme.palette.primary.main};
128
+ // margin: 0 auto;
129
+ // margin-bottom: 20px;
130
+ }
131
+ .node-bullet-icon {
132
+ position: absolute;
133
+ top: 4px;
134
+ left: 4px;
135
+ // transform: translate(-50%, -50%);
136
+ color: ${(props) => props.theme.palette.primary.contrastText};
137
+ }
138
+ `;
139
+
140
+ const Line = styled(({ className }) => {
141
+ return <div className={className}></div>;
142
+ })`
143
+ width: 1px;
144
+ height: 100px;
145
+ // border-radius: 50%;
146
+ background-color: ${(props) => props.theme.palette.primary.main};
147
+ // margin: 0 auto;
148
+ // margin-bottom: 20px;
149
+ `;
150
+
151
+ const NodeContent = styled(({ className }) => {})``;
152
+
153
+ export default Timeline;
package/src/index.js ADDED
File without changes