-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
138 lines (122 loc) · 3.58 KB
/
index.html
1
2
3
4
5
6
7
8
9
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
62
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
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src ="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js">
</script>
<script src ="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src ="https://npmcdn.com/babel-core@5.8.38/browser.min.js">
</script>
</head>
<body>
<script type="text/babel">
class Header extends React.Component{
constructor(props){
super(props);
this.state ={
searchVisible: false
}
}
showSearch(){
this.setState({
searchVisible: !this.state.searchVisible
})
}
render(){
let searchInClasses = ["searchInput"];
if(this.state.searchVisible){
searchInClasses.push("active");
}
return (
<div className="header">
<div className="fa fa-more"></div>
<span className="title"> {this.props.title} </span>
<input
type ="text"
className={searchInClasses.join(" ")}
placeholder ="Search..."/>
<div
onClick = {this.showSearch.bind(this)}
className="fa fa-search searchIcon"></div>
</div>
)
}
}
const activities =
[
{
timestamp: new Date().getTime(),
text: "Ate Lunch",
user: {
id: 1,
name: "Nate",
avatar:"http://croop.cl/UI/twitter/images/doug.jpg"
},
comments:[
{from: 'Ari', text: 'Me too'}
]
},
{
timestamp: new Date().getTime(),
text: "Ate Dinner and breakfast",
user: {
id: 2,
name: "Maija",
avatar:"http://croop.cl/UI/twitter/images/up.jpg"
},
comments:[
{from: 'Ari', text: 'Me too'}, {me:"1990"}
]
}
]
class App extends React.Component{
render(){
return (
<div className="notificationFrame">
<div className="panel">
<Header title ="Timeline"/>
<Content activities = {activities} />
</div>
</div>
)
}
}
class ActivityItem extends React.Component{
render(){
const activity =this.props.activity;
return(
<div className="item">
<div className="avatar">
<img src= {activity.user.avatar} alt="avatar"/>
{activity.user.name}
</div>
<span className="time">{activity.timestamp}</span>
<p>{activity.text}</p>
<div className="commentCount">{activity.comments.length}</div>
</div>
)
}
}
class Content extends React.Component{
render(){
const activities = this.props.activities;
return(
<div className="content">
<div className="line"></div>
{activities.map((activity) =>(
<ActivityItem activity = {activity}/>
))}
</div>
)
}
}
var b = document.querySelector('body');
ReactDOM.render(<App/>,b)
</script>
</body>
</html>