File tree Expand file tree Collapse file tree 6 files changed +145
-6
lines changed Expand file tree Collapse file tree 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';
22import './Stories.css' ;
33import Story from './Story' ;
44
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+
527const Stories = ( { stories } ) =>
628 < div className = "stories" >
29+ < StoriesHeader columns = { COLUMNS } />
30+
731 { ( stories || [ ] ) . map ( story =>
832 < Story
933 key = { story . objectID }
1034 story = { story }
35+ columns = { COLUMNS }
1136 />
1237 ) }
1338 </ div >
1439
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+
1552export 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 11import React from 'react' ;
22import './Story.css' ;
33
4- const Story = ( { story } ) => {
4+ const Story = ( { story, columns } ) => {
55 const {
66 title,
77 url,
@@ -12,12 +12,20 @@ const Story = ({ story }) => {
1212
1313 return (
1414 < div className = "story" >
15- < span >
15+ < span style = { { width : columns . title . width } } >
1616 < a href = { url } > { title } </ a >
1717 </ 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 >
2129 </ div >
2230 ) ;
2331}
Original file line number Diff line number Diff line change 11body {
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 ;
218 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;
348 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 ;
556}
57+
58+ * : focus {
59+ outline : none;
60+ }
You can’t perform that action at this time.
0 commit comments