File tree 6 files changed +145
-6
lines changed
6 files changed +145
-6
lines changed Original file line number Diff line number Diff line change
1
+ .app {
2
+ margin : 20px ;
3
+ }
4
+
5
+ .interactions , .error {
6
+ text-align : center;
7
+ }
Original file line number Diff line number Diff line change
1
+ .stories {
2
+ margin : 20px 0 ;
3
+ }
4
+
5
+ .stories-header {
6
+ display : flex;
7
+ line-height : 24px ;
8
+ font-size : 16px ;
9
+ padding : 0 10px ;
10
+ justify-content : space-between;
11
+ }
12
+
13
+ .stories-header > span {
14
+ overflow : hidden;
15
+ text-overflow : ellipsis;
16
+ padding : 0 5px ;
17
+ }
Original file line number Diff line number Diff line change @@ -2,14 +2,51 @@ import React from 'react';
2
2
import './Stories.css' ;
3
3
import Story from './Story' ;
4
4
5
+ const COLUMNS = {
6
+ title : {
7
+ label : 'Title' ,
8
+ width : '40%' ,
9
+ } ,
10
+ author : {
11
+ label : 'Author' ,
12
+ width : '30%' ,
13
+ } ,
14
+ comments : {
15
+ label : 'Comments' ,
16
+ width : '10%' ,
17
+ } ,
18
+ points : {
19
+ label : 'Points' ,
20
+ width : '10%' ,
21
+ } ,
22
+ archive : {
23
+ width : '10%' ,
24
+ } ,
25
+ } ;
26
+
5
27
const Stories = ( { stories } ) =>
6
28
< div className = "stories" >
29
+ < StoriesHeader columns = { COLUMNS } />
30
+
7
31
{ ( stories || [ ] ) . map ( story =>
8
32
< Story
9
33
key = { story . objectID }
10
34
story = { story }
35
+ columns = { COLUMNS }
11
36
/>
12
37
) }
13
38
</ div >
14
39
40
+ const StoriesHeader = ( { columns } ) =>
41
+ < div className = "stories-header" >
42
+ { Object . keys ( columns ) . map ( key =>
43
+ < span
44
+ key = { key }
45
+ style = { { width : columns [ key ] . width } }
46
+ >
47
+ { columns [ key ] . label }
48
+ </ span >
49
+ ) }
50
+ </ div >
51
+
15
52
export default Stories ;
Original file line number Diff line number Diff line change
1
+ .story {
2
+ display : flex;
3
+ line-height : 24px ;
4
+ white-space : nowrap;
5
+ margin : 10px 0 ;
6
+ padding : 10px ;
7
+ background : # ffffff ;
8
+ border : 1px solid # e3e3e3 ;
9
+ }
10
+
11
+ .story > span {
12
+ overflow : hidden;
13
+ text-overflow : ellipsis;
14
+ padding : 0 5px ;
15
+ }
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import './Story.css' ;
3
3
4
- const Story = ( { story } ) => {
4
+ const Story = ( { story, columns } ) => {
5
5
const {
6
6
title,
7
7
url,
@@ -12,12 +12,20 @@ const Story = ({ story }) => {
12
12
13
13
return (
14
14
< div className = "story" >
15
- < span >
15
+ < span style = { { width : columns . title . width } } >
16
16
< a href = { url } > { title } </ a >
17
17
</ span >
18
- < span > { author } </ span >
19
- < span > { num_comments } </ span >
20
- < span > { points } </ span >
18
+ < span style = { { width : columns . author . width } } >
19
+ { author }
20
+ </ span >
21
+ < span style = { { width : columns . comments . width } } >
22
+ { num_comments }
23
+ </ span >
24
+ < span style = { { width : columns . points . width } } >
25
+ { points }
26
+ </ span >
27
+ < span style = { { width : columns . archive . width } } >
28
+ </ span >
21
29
</ div >
22
30
) ;
23
31
}
Original file line number Diff line number Diff line change 1
1
body {
2
+ color : # 222 ;
3
+ background : # f4f4f4 ;
4
+ font : 400 14px CoreSans, Arial, sans-serif;
5
+ }
6
+
7
+ a {
8
+ color : # 222 ;
9
+ }
10
+
11
+ a : hover {
12
+ text-decoration : underline;
13
+ }
14
+
15
+ ul , li {
16
+ list-style : none;
17
+ padding : 0 ;
2
18
margin : 0 ;
19
+ }
20
+
21
+ input {
22
+ padding : 10px ;
23
+ border-radius : 5px ;
24
+ outline : none;
25
+ margin-right : 10px ;
26
+ border : 1px solid # dddddd ;
27
+ }
28
+
29
+ button {
30
+ padding : 10px ;
31
+ border-radius : 5px ;
32
+ border : 1px solid # dddddd ;
33
+ background : transparent;
34
+ color : # 808080 ;
35
+ cursor : pointer;
36
+ }
37
+
38
+ button : hover {
39
+ color : # 222 ;
40
+ }
41
+
42
+ .button-inline {
43
+ border-width : 0 ;
44
+ background : transparent;
45
+ color : inherit;
46
+ text-align : inherit;
47
+ -webkit-font-smoothing : inherit;
3
48
padding : 0 ;
4
- font-family : sans-serif;
49
+ font-size : inherit;
50
+ cursor : pointer;
51
+ }
52
+
53
+ .button-active {
54
+ border-radius : 0 ;
55
+ border-bottom : 1px solid # 38BB6C ;
5
56
}
57
+
58
+ * : focus {
59
+ outline : none;
60
+ }
You can’t perform that action at this time.
0 commit comments