Skip to content

Commit b332f4e

Browse files
Merge pull request #7 from ekonstantinidis/notifications-style
Style Notifications & Split to Repo & Notifications
2 parents 3e7447d + eb4511d commit b332f4e

File tree

4 files changed

+80
-15
lines changed

4 files changed

+80
-15
lines changed

src/js/components/notification.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ var Notification = React.createClass({
4040

4141
return (
4242
<div className='row notification'>
43-
<span className={typeIconClass} />
44-
<span onClick={this.openBrowser}>{this.props.notification.subject.title}</span>
45-
<span className="octicon octicon-check" onClick={this.markAsRead}></span>
43+
<div className='col-xs-1'><span className={typeIconClass} /></div>
44+
<div className='col-xs-10 subject' onClick={this.openBrowser}>
45+
{this.props.notification.subject.title}
46+
</div>
47+
<div className='col-xs-1 check-wrapper'><span className="octicon octicon-check" onClick={this.markAsRead} /></div>
4648
</div>
4749
);
4850
}

src/js/components/notifications.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var shell = remote.require('shell');
77

88
var Actions = require('../actions/actions');
99
var NotificationsStore = require('../stores/notifications');
10-
var SingleNotification = require('../components/notification');
10+
var Repository = require('../components/repository');
1111

1212
var Notifications = React.createClass({
1313
mixins: [
@@ -43,16 +43,8 @@ var Notifications = React.createClass({
4343
if (!_.isEmpty(this.state.notifications)) {
4444
notifications = (
4545
_.map(this.state.notifications, function(repo, i) {
46-
return (
47-
<div key={i}>
48-
<h4 onClick={self.openRepoBrowser.bind(self, i)}>{i}</h4>
49-
{repo.map(function(as, df) {
50-
return (
51-
<SingleNotification notification={as} key={as.id} />
52-
);
53-
})}
54-
</div>
55-
);
46+
var repoFullName = repo[0].repository.full_name;
47+
return <Repository repo={repo} repoName={repoFullName} key={i} />;
5648
})
5749
);
5850
} else {

src/js/components/repository.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
var React = require('react');
2+
var SingleNotification = require('../components/notification');
3+
var _ = require('underscore');
4+
5+
var Repository = React.createClass({
6+
7+
getAvatar: function () {
8+
return this.props.repo[0].repository.owner.avatar_url;
9+
},
10+
11+
render: function () {
12+
var notifications = (
13+
_.map(this.props.repo, function(notification, i) {
14+
return (
15+
<SingleNotification notification={notification} key={i} />
16+
);
17+
})
18+
);
19+
20+
return (
21+
<div>
22+
<div className='row repository'>
23+
<div className='col-xs-2'><img className='avatar' src={this.getAvatar()} /></div>
24+
<div className='col-xs-10 name'>{this.props.repoName}</div>
25+
</div>
26+
{notifications}
27+
</div>
28+
);
29+
}
30+
});
31+
32+
module.exports = Repository;

src/less/style.less

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,29 @@ html, body {
237237
/* @end Component / Login */
238238

239239

240+
/* @group Component / Repository */
241+
242+
.repository {
243+
padding: 10px 20px;
244+
margin: 0;
245+
background-color: #f5f5f5;
246+
247+
.avatar {
248+
.BorderRadius(50%);
249+
width: 25px;
250+
height: 25px;
251+
}
252+
253+
.name {
254+
font-size: 18px;
255+
.FontOpenSansSemibold();
256+
text-align: right;
257+
}
258+
}
259+
260+
/* @end Component / Repository */
261+
262+
240263
/* @group Component / Notifications */
241264

242265
.notifications {
@@ -257,10 +280,26 @@ html, body {
257280

258281
.notification {
259282
margin: 0;
260-
padding: 10px 20px;
283+
padding: 3px 20px;
284+
285+
.col-xs-1,
286+
.col-xs-10 {
287+
padding: 5px 0;
288+
}
289+
290+
.check-wrapper {
291+
text-align: right;
292+
}
293+
294+
.subject {
295+
white-space: nowrap;
296+
overflow: hidden;
297+
text-overflow: ellipsis;
298+
}
261299

262300
.octicon {
263301
margin-right: 10px;
302+
font-size: 20px;
264303
}
265304
}
266305

0 commit comments

Comments
 (0)