Skip to content

Commit 57c095b

Browse files
committed
Add styling and details to commit list items
1 parent aaff242 commit 57c095b

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/routes/Commits/routes/List/components/CommitListItem.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Stream } from 'xstream';
2-
import { DOMSource, VNode, li } from '@cycle/dom';
2+
import { DOMSource, VNode, li, h4, h5, strong, em } from '@cycle/dom';
33
import isolate from '@cycle/isolate';
44
import { Commit } from 'drivers/github';
5+
import { style } from 'typestyle';
6+
import { rem } from 'csx';
57

68
interface Sources {
79
dom: DOMSource;
@@ -13,6 +15,23 @@ interface Sinks {
1315
history: Stream<string>;
1416
}
1517

18+
const className = style({
19+
marginBottom: rem(1),
20+
border: `${rem(.1)} solid #ddd`,
21+
padding: rem(1),
22+
listStyle: 'none',
23+
borderRadius: rem(.5),
24+
$nest: {
25+
'h4, h5': {
26+
marginTop: 0,
27+
marginBottom: rem(.5)
28+
},
29+
h5: {
30+
marginBottom: 0
31+
}
32+
}
33+
});
34+
1635
const CommitListItemComponent = ({ dom, commit$ }: Sources): Sinks => {
1736
const navigateTo$ =
1837
commit$
@@ -21,7 +40,15 @@ const CommitListItemComponent = ({ dom, commit$ }: Sources): Sinks => {
2140
const vdom$ =
2241
commit$
2342
.map(({ sha, commit: { message, author: { name, email, date } } }) =>
24-
li([ message ])
43+
li(`.${className}`, [
44+
h4([strong([message.split('\n\n')[0]])]),
45+
h5([
46+
'by ',
47+
strong([name]),
48+
' at ',
49+
em([date])
50+
])
51+
])
2552
);
2653
return {
2754
dom: vdom$,

0 commit comments

Comments
 (0)