Skip to content

Commit 8989600

Browse files
Leslie RoseLeslie Rose
Leslie Rose
authored and
Leslie Rose
committed
updated with styling
1 parent 20ef311 commit 8989600

File tree

80 files changed

+158
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+158
-213
lines changed

client/public/favicon.ico

7.03 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
.deletebutton {
22
float: right;
3-
color: #e74944;
3+
background-color:#dc6f68;
44
}
5+
6+
.deletebutton:hover {
7+
background-color: rgb(0, 255, 234);
8+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.formButton {
2+
float: right;
3+
background-color:#dc6f68!important;
4+
border: none;
5+
color: black!important;
6+
}
7+
8+
.formButton:hover {
9+
background-color: rgb(0, 255, 234);
10+
border: none;
11+
}

client/src/components/Form/FormBtn.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from "react";
2+
import "./FormBtn.css";
23

34
export const FormBtn = props => (
4-
<button {...props} style={{ float: "right", marginBottom: 10 }} className="btn btn-success">
5+
<button {...props} style={{ float: "right", marginBottom: 10 }} className="btn btn-success formButton">
56
{props.children}
67
</button>
78
);

client/src/components/Form/Input.css

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.form-control:valid {
2+
background-color: #000000;
3+
}
4+
*::-webkit-input-placeholder {
5+
color: #dc6f68!important;
6+
}
7+
*:-moz-placeholder {
8+
/* FF 4-18 */
9+
color: dc6f68!important;
10+
}
11+
*::-moz-placeholder {
12+
/* FF 19+ */
13+
color: dc6f68!important;
14+
}
15+
*:-ms-input-placeholder {
16+
/* IE 10+ */
17+
color: dc6f68!important;
18+
}
19+
20+
.form-control {
21+
color: #dc6f68!important;
22+
}

client/src/components/Form/Input.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React from "react";
2+
import "./Input.css";
3+
24

35
export const Input = props => (
46
<div className="form-group">
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.container-fluid {
2+
padding-top: 60px;
3+
background-color: rgb(240, 233, 233);
4+
}
5+
6+
body {
7+
background-color: rgb(240, 233, 233);
8+
}

client/src/components/Grid/Container.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
import "./Container.css";
23

34
export const Container = ({ fluid, children }) => (
45
<div className={`container${fluid ? "-fluid" : ""}`}>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@font-face {
2+
font-family: "Newspaper";
3+
src: url("../../fonts/newspaperfont.ttf");
4+
font-weight: normal;
5+
}
6+
7+
8+
.jumbotron {
9+
background: url("../../images/newspaperbackground.jpg");
10+
border: rgb(0, 255, 234) solid 10px;
11+
}
12+
13+
h1 {
14+
font-family: "Newspaper", Arial, Helvetica, sans-serif;
15+
font-size: 80px;
16+
margin-top: -30px;
17+
}
18+
19+
@media screen and (max-width: 701px) {
20+
21+
h1 {
22+
font-size: 70px;
23+
}
24+
}
25+
26+
@media screen and (max-width: 520px) {
27+
28+
h1 {
29+
font-size: 50px;
30+
}
31+
}
32+
33+
@media screen and (max-width: 400px) {
34+
35+
h1 {
36+
font-size: 50px;
37+
margin-top: -50px;
38+
}
39+
}
40+

client/src/components/Jumbotron/Jumbotron.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
import "./Jumbotron.css";
23

34
const Jumbotron = ({ children }) => (
45
<div

client/src/components/List/List.css

+10
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@
3131
.list-overflow-container li:last-child {
3232
border-bottom: none;
3333
}
34+
35+
.list-group-item a {
36+
text-decoration: none;
37+
color:#dc6f68!important;
38+
39+
}
40+
41+
.list-group-item a:hover {
42+
color: rgb(0, 255, 234)!important;
43+
}

client/src/components/Nav/Nav.css

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.navbar {
2+
background-color: rgb(0, 0, 0)!important;
3+
box-shadow: 0 4px 18px 0 rgba(0, 0, 0, 0.2), 0 20px 20px 0 rgba(0, 0, 0, 0.19);
4+
position: fixed;
5+
width: 100%;
6+
}
7+
8+
a:hover {
9+
color: rgb(0, 255, 234);
10+
}
11+
12+
.nav-link {
13+
font-size: 16px;
14+
margin-top: 3px;
15+
}

client/src/components/Nav/Nav.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from "react";
2+
import "./Nav.css";
23

34
const Nav = () => (
4-
<nav className="navbar navbar-expand-lg navbar-dark bg-primary">
5+
<nav className="navbar navbar-expand-lg bg-primary sticky-top">
56
<a className="navbar-brand" href="/">
67
NYT ARTICLE SCRUBBER
78
</a>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
.savebutton {
1+
.save-button {
22
float: right;
3-
color: #e74944;
3+
background-color:#dc6f68;
4+
}
5+
6+
.save-button:hover {
7+
background-color: rgb(0, 255, 234);
48
}

client/src/fonts/newspaperfont.ttf

107 KB
Binary file not shown.
339 KB

client/src/pages/saved/Saved.js

+7-37
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,15 @@ import Jumbotron from "../../components/Jumbotron";
44
import nytapi from "../../utils/nyt/nytapi";
55
import { Col, Row, Container } from "../../components/Grid";
66
import { List, ListItem } from "../../components/List";
7-
import { Input, FormBtn } from "../../components/Form";
8-
// import Note from "../Note";
9-
107

118
class Saved extends Component {
129
state = {
1310
search: "",
11+
title: "",
1412
startYear: "",
1513
endYear: "",
1614
articles: [],
1715
savedArticles: [],
18-
title: "",
19-
savedNotes: [],
20-
note: ""
2116
};
2217

2318
componentDidMount() {
@@ -39,7 +34,6 @@ class Saved extends Component {
3934
.then(res => {
4035
console.log(res)
4136
this.setState({ articles: res.data.response.docs });
42-
// console.log(res.data)
4337
})
4438
.catch(err => console.log(err));
4539
}
@@ -58,7 +52,7 @@ class Saved extends Component {
5852

5953
//Find the article from the articles array with the ID matching the saved button
6054
const articleSaveButtonContent = (this.state.articles.filter(element => element._id === event.target.id)[0]);
61-
nytapi.saveArticle({ title: articleSaveButtonContent.headline.main, author: articleSaveButtonContent.source, summary: articleSaveButtonContent.snippet, articleDate: articleSaveButtonContent.pub_date, link: articleSaveButtonContent.web_url, note: "none" })
55+
nytapi.saveArticle({ title: articleSaveButtonContent.headline.main, author: articleSaveButtonContent.source, summary: articleSaveButtonContent.snippet, articleDate: articleSaveButtonContent.pub_date, link: articleSaveButtonContent.web_url})
6256
.then(res =>
6357
this.loadSavedArticles())
6458
.catch(err => console.log(err));
@@ -86,16 +80,7 @@ class Saved extends Component {
8680

8781
render() {
8882
return (
89-
<Container fluid>
90-
<Row>
91-
<Col size="md-12">
92-
<Jumbotron>
93-
<h1>New York Times Article Scrubber</h1>
94-
</Jumbotron>
95-
96-
</Col>
97-
</Row>
98-
83+
<Container fluid>
9984
<Row>
10085
<Col size="md-12 sm-12">
10186
<Jumbotron>
@@ -109,28 +94,13 @@ class Saved extends Component {
10994
<h2>{article.title}</h2>
11095
</strong>
11196
<h5>Date published: {article.articleDate}</h5>
97+
<h5>Date saved: {article.date}</h5>
11298
<h6>{article.summary}</h6>
11399

114-
<a href={article.link} target="blank"> Link</a>
115-
<form>
116-
<Input
117-
key={article._id}
118-
id={article._id}
119-
value={this.state.note}
120-
onChange={this.handleInputChange}
121-
name="note"
122-
placeholder="Notes"
123-
/>
100+
<a href={article.link} target="blank"> <span role="img" aria-label="newspaper1">📰</span> Read More Here <span role="img" aria-label="newspaper2">📰</span></a>
101+
124102
<DeleteButton id={article._id} onClick={this.deleteArticleFunction} />
125-
{/* <Notes id={article._id} onClick={this.addNoteFunction} data-toggle="modal" data-target="#NotesModal" /> */}
126-
<FormBtn
127-
// id={note._id}
128-
disabled={!(this.state.note)}
129-
onClick={this.addNoteFunction}
130-
>
131-
Submit
132-
</FormBtn>
133-
</form>
103+
134104
</ListItem>
135105

136106
))}

client/src/pages/search/SearchArticles.js

+14-40
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import React, { Component } from "react";
22
import SaveButton from "../../components/SaveButton";
3-
import DeleteButton from "../../components/DeleteButton";
43
import Jumbotron from "../../components/Jumbotron";
54
import nytapi from "../../utils/nyt/nytapi";
6-
import { Link } from "react-router-dom";
75
import { Col, Row, Container } from "../../components/Grid";
86
import { List, ListItem } from "../../components/List";
97
import { Input, FormBtn } from "../../components/Form";
10-
// import Note from "../Note";
118

129

1310
class SearchArticles extends Component {
@@ -18,21 +15,22 @@ class SearchArticles extends Component {
1815
articles: [],
1916
savedArticles: [],
2017
title: "",
21-
notes: ""
2218
};
2319

2420

2521

2622
searchArticle = (event) => {
2723
event.preventDefault();
24+
2825
nytapi.getArticles(this.state.search, this.state.startYear, this.state.endYear)
2926
.then(res => {
30-
console.log(res)
27+
console.log(res.data.response.docs)
3128
this.setState({ articles: res.data.response.docs });
32-
// console.log(res.data)
3329
})
34-
.catch(err => console.log(err));
35-
}
30+
.then(res =>
31+
alert("📰 Articles found! 📰"))
32+
.catch(err => console.log(err));
33+
}
3634

3735
deleteArticleFunction = (event) => {
3836
event.preventDefault();
@@ -48,37 +46,13 @@ class SearchArticles extends Component {
4846

4947
//Find the article from the articles array with the ID matching the saved button
5048
const articleSaveButtonContent = (this.state.articles.filter(element => element._id === event.target.id)[0]);
51-
nytapi.saveArticle({ title: articleSaveButtonContent.headline.main, author: articleSaveButtonContent.source, summary: articleSaveButtonContent.snippet, articleDate: articleSaveButtonContent.pub_date, link: articleSaveButtonContent.web_url, note: "none" })
49+
nytapi.saveArticle({ title: articleSaveButtonContent.headline.main, author: articleSaveButtonContent.source, summary: articleSaveButtonContent.snippet, articleDate: articleSaveButtonContent.pub_date, link: articleSaveButtonContent.web_url
50+
})
5251
.then(res =>
53-
alert("Article saved!"))
52+
alert("📰 Article saved! 📰"))
5453
.catch(err => console.log(err));
5554
};
5655

57-
// addNoteFunction = event => {
58-
// event.preventDefault();
59-
60-
// console.log(this.state.note
61-
// )
62-
63-
// nytapi.saveNote({note: this.state.note
64-
// })
65-
// .then(res =>
66-
// this.loadSavedNotes()
67-
// )
68-
// .catch(err => console.log(err));
69-
// };
70-
71-
// loadSavedNotes = (event) => {
72-
// event.preventDefault();
73-
// nytapi.getSavedNotes()
74-
// .then(res => {
75-
// this.setState({ savedNotes: res.data })
76-
// console.log(res.data)
77-
// })
78-
// .catch(err => console.log(err));
79-
// }
80-
81-
8256
handleInputChange = event => {
8357
const { name, value } = event.target;
8458
this.setState({
@@ -112,25 +86,25 @@ class SearchArticles extends Component {
11286
value={this.state.search}
11387
onChange={this.handleInputChange}
11488
name="search"
115-
placeholder="Search Term (required)"
89+
placeholder="Search Term"
11690
/>
11791
<Input
11892
value={this.state.startYear}
11993
onChange={this.handleInputChange}
12094
name="startYear"
121-
placeholder="Start Date (optional)"
95+
placeholder="Start Date"
12296
/>
12397
<Input
12498
value={this.state.endYear}
12599
onChange={this.handleInputChange}
126100
name="endYear"
127-
placeholder="End Date (optional)"
101+
placeholder="End Date"
128102
/>
129103
<FormBtn
130104
disabled={!(this.state.search && this.state.startYear && this.state.endYear)}
131105
onClick={this.searchArticle}
132106
>
133-
Submit
107+
SUBMIT
134108
</FormBtn>
135109
</form>
136110
</Col>
@@ -149,7 +123,7 @@ class SearchArticles extends Component {
149123
<h5>Date published: {article.pub_date}</h5>
150124
<h6>{article.snippet}</h6>
151125

152-
<a href={article.web_url} target="blank"> Link</a>
126+
<a href={article.web_url} target="blank"> <span role="img" aria-label="newspaper1">📰</span> Read more here <span role="img" aria-label="newspaper2">📰</span></a>
153127
<SaveButton id={article._id} onClick={this.saveArticleFunction} />
154128
</ListItem>
155129
))}

0 commit comments

Comments
 (0)