Newer
Older
function TimeItem({tag, title, children, pic, author, tabid}: ItemProps){
return(
<li className="timelineolli">
<div className="timeline-item moretop">
<div className="">
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{tag}
</div>
<div className="row align-items-center">
<div className="col" >
<span className="tl-butt" onClick={Open({person: author})}> <img className="img-round" src={pic} /></span>
</div>
<div className="col" >
{title}
</div>
</div>
<p>{children}</p>
<div className="tab">
<button className="tablinks" onClick={openCity({cityName: tabid})}>More</button>
</div>
</div>
</div>
</li>
)
}
export function AllPopus(){
let rows = []
for ( let i = 0; i < data.length; i++ ){
rows.push(<Popup person={data[i].author}>
Hi
</Popup>)
}
return rows;
}
export function TimeHori(){
return(
<div>
<section className="timeline row align-items-center">
<ol className="timelineol">
<AllItems></AllItems>
<li className="timelineolli"></li>
</ol>
</section>
</div>
)
}
function Open({person}:{person: string}){
const openPop = (_event : React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var popup = document.getElementById(person);
popup!.classList.toggle("show");
}
return openPop;
}
interface PopProps {
person: string,
children: React.ReactNode
}
function Popup({person, children}: PopProps){
return(
<div id="myPopup" className="popup">
<span className="popuptext" id={person}>
<div>
{children}
</div>
<button onClick={Open({person})} >Close</button>
</span>
</div>
)
}
function openCity({cityName}:{cityName: string}) {
const opencity = (event : React.MouseEvent<HTMLButtonElement, MouseEvent>) =>{
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
(tabcontent[i] as HTMLElement).style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(cityName)!.style.display = "block";
event.currentTarget.className += " active";
}
return opencity;
}
interface ItemProps {
title: string ,
children: React.ReactNode;
tag: string,
pic: string,
author: string,
tabid: string
}
function AllItems(){
let rows = []
for ( let i = 0; i < data.length; i++ ){
rows.push(<TimeItem
title={data[i].title}
pic={data[i].pic}
tag={data[i].tag}
author={data[i].author}
tabid={data[i].tabid}
>
{data[i].text}
</TimeItem>)
}
return rows;
}
export function getTypeItems(ta: string){
let rows = []
for ( let i = 0; i < data.length; i++ ){
if (ta = data[i].tag)
rows.push(<TimeItem
title={data[i].title}
pic={data[i].pic}
tag={data[i].tag}
author={data[i].author}
tabid={data[i].tabid}
>
{data[i].text}
</TimeItem>)
}
return rows;
}
let data = [
{
title: "Deutlich längerer Titel zum Test",
pic: "https://static.igem.wiki/teams/5247/placeholders/placehilderperson.jpeg",
text: "Text",
},
{
title: "Deutlich längerer Titel zum Test",
pic: "https://static.igem.wiki/teams/5247/placeholders/placehilderperson.jpeg",
text: "Text",
},
{
title: "Deutlich längerer Titel zum Test" ,
pic: "https://static.igem.wiki/teams/5247/placeholders/placehilderperson.jpeg",
text: "Text",
}
]