Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions social-network/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "social-network",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"react-test-renderer": "^16.3.2"
}
}
Binary file added social-network/public/favicon.ico
Binary file not shown.
40 changes: 40 additions & 0 deletions social-network/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions social-network/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
31 changes: 31 additions & 0 deletions social-network/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.App {
text-align: left;
display: block;
margin-left: 10px;
font-family: medium-content-sans-serif-font,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you didn't have to use the exact font-family used on Medium, I like that you went to their site and saw how they were implementing their CSS. It's a great way to learn new styling methods and tricks 👍

}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
}

.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
}

.App-title {
font-size: 1.5em;
}

.App-intro {
font-size: large;
}

@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
16 changes: 16 additions & 0 deletions social-network/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import CreativityPage from './CreativityPage';

class App extends Component {
render() {
return (
<div className="App">
<CreativityPage />
</div>
);
}
}

export default App;
9 changes: 9 additions & 0 deletions social-network/src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
91 changes: 91 additions & 0 deletions social-network/src/CreativityPage/Article.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

.ForYouSection {
display: flex;
flex-wrap: wrap;
border-top: 1px solid lightgrey;
}
.MissedSection {
display: flex;
flex-wrap: wrap;
border-top: 1px solid lightgrey;
}

.flex-container-box-two-per-row {
display: flex;
/*flex-wrap: nowrap;*/
flex-direction: row;
border: 1px solid lightgrey;
margin: 10px;
width: 45%;
}
.flex-container-box-three-per-row {
display: flex;
flex-wrap: wrap;
/*flex-wrap: nowrap;*/
flex-direction: row;
border: 1px solid lightgrey;
margin: 10px;
width: 30%;
}

.flex-container-box-generic {
display: flex;
flex-wrap: wrap;
flex-direction: row;
margin: 10px;
}

/* Within a box, this is all the stuff right of the image*/
.flex-container-contents {
display: flex;
/*flex-wrap: wrap;*/
flex-direction: column;
padding-left: 10px;
max-width: 300px;
}

/* Within a container-contents, this is author image, name, date and readtime data*/
.flex-container-metadata {
display: flex;
/*flex-wrap: wrap;*/
flex-direction: row;
padding-bottom: 8px;
font-size: 14px;
}

/* Within flex-container-metadata, this is everything to the right of author pic*/
.flex-container-md-column {
display: flex;
flex-direction: column;
padding-left: 10px;
color: rgba(0,0,0,.54);
}

.flex-container-md-row {
display: flex;
/*flex-wrap: wrap;*/
flex-direction: row;
align-items: center;
padding-bottom: 10px;
}

/* Within container-metadata, this is the name, date, readtime */
.flex-container-meta-text {
display: flex;
/*flex-wrap: wrap;*/
flex-direction: column;
}

.flex-container-space-filler {
flex-grow: 1; /*grow to fill space to push what comes after to bottom of box*/
}
.ArticleMinutesToRead {
position: relative;
}
.Circle {
border-radius: 50%;
width: 3px;
height: 3px;
background-color: lightgrey;
margin: 5px;
}
46 changes: 46 additions & 0 deletions social-network/src/CreativityPage/ArticleItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React, { Component } from 'react';
import Title from './Title';
import Description from './Description';
import ImageArticle from './ImageArticle';
import Favorites from './Favorites';
import ImageAuthor from './ImageAuthor';
import PostDate from './PostDate';
import NameAuthor from './NameAuthor';
import MinutesToRead from './MinutesToRead';
import './Article.css'

class ArticleItem extends Component {
render() {
const articleMetaData = this.props.articleMetaData;

return (
<div className="flex-container-box-generic">
<ImageArticle image={articleMetaData.image} />
<div className="flex-container-contents">
<Title title={articleMetaData.title} />
<Description description={articleMetaData.description} />
<div className="flex-container-space-filler"></div>
<div className="flex-container-metadata">
<ImageAuthor image={articleMetaData.author.image} />
<div className = "flex-container-md-column">
<div className="flex-container-space-filler"></div>
<div className="flex-container-md-row">
<NameAuthor authorName={articleMetaData.author.name} />
<div className="flex-container-space-filler"></div>
<Favorites />
</div>
<div className="flex-container-space-filler"></div>
<div className="flex-container-md-row">
<PostDate postDate={articleMetaData.postedDate} />
<div className="Circle" />
<MinutesToRead minutesToRead={articleMetaData.minutesToRead} />
</div>
</div>
</div>
</div>
</div>
);
}
}

export default ArticleItem;
17 changes: 17 additions & 0 deletions social-network/src/CreativityPage/Creativity.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import CreativityPage from './index';
import ArticleItem from './ArticleItem';
import ReactTestRenderer from 'react-test-renderer';

describe('CreativityPage component', () => {
it('should render', () => {
const component = ReactTestRenderer.create(<CreativityPage />);
expect(component.toJSON()).toMatchSnapshot();
});
});
describe('ArticleItem component', () => {
it('should render', () => {
const component = ReactTestRenderer.create(<ArticleItem />);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get this test to pass, you'll want to pass in some fake data for the articleMetaData prop. Also, make sure to save the snapshot to git so that other developers can compare your test results.

expect(component.toJSON()).toMatchSnapshot();
});
});
7 changes: 7 additions & 0 deletions social-network/src/CreativityPage/Description.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.ArticleDescription {
color: rgba(0,0,0,.54);
fill: rgba(0,0,0,.54);
font-size: 14px;
position: relative;
padding-top: 10px;
}
23 changes: 23 additions & 0 deletions social-network/src/CreativityPage/Description.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './Description.css'

class Description extends Component {

render() {
const articleDescription = this.props.description;
return (
<div className="ArticleDescription">{articleDescription}</div>
);
}
}

Description.propTypes = {
description: PropTypes.string
};

Description.defaultProps = {
description: ''
};

export default Description;
17 changes: 17 additions & 0 deletions social-network/src/CreativityPage/Favorites.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { Component } from 'react';

class Favorites extends Component {
render() {
return (
<svg width="25" height="25" viewBox="0 0 25 25">
<path d={
(
'M 19 6 c 0 -1.1 -0.9 -2 -2 -2 H 8 c -1.1 0 -2 0.9 -2 2 v 14.66 h 0.012 c 0.01 0.103 0.045 0.204 0.12 0.285 a 0.5 0.5 0 0 0 0.706 0.03 L 12.5 16.85 l 5.662 4.126 a 0.508 0.508 0 0 0 0.708 -0.03 a 0.5 0.5 0 0 0 0.118 -0.285 H 19 V 6 Z m -6.838 9.97 L 7 19.636 V 6 c 0 -0.55 0.45 -1 1 -1 h 9 c 0.55 0 1 0.45 1 1 v 13.637 l -5.162 -3.668 a 0.49 0.49 0 0 0 -0.676 0 Z'
)
} fillRule='evenodd'></path>
</svg>
);
}
}

export default Favorites;
5 changes: 5 additions & 0 deletions social-network/src/CreativityPage/ImageArticle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.ImageArticle {
display: flex;
width: 200px;
height: 200px;
}
23 changes: 23 additions & 0 deletions social-network/src/CreativityPage/ImageArticle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './ImageArticle.css'

class ImageArticle extends Component {

render() {
const articleImage = this.props.image;
return (
<img className={"ImageArticle"} src={articleImage} />
);
}
}

ImageArticle.propTypes = {
image: PropTypes.string
};

ImageArticle.defaultProps = {
image: ''
};

export default ImageArticle;
5 changes: 5 additions & 0 deletions social-network/src/CreativityPage/ImageAuthor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.ImageAuthor {
border-radius: 50%;
width: 50px;
height: 50px;
}
Loading