-
Notifications
You must be signed in to change notification settings - Fork 27
Week 2 Homework #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
caitlynchung
wants to merge
1
commit into
modern-web-application-uw18:master
Choose a base branch
from
caitlynchung:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Week 2 Homework #13
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
|
|
||
| .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); } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 />); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| expect(component.toJSON()).toMatchSnapshot(); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .ImageArticle { | ||
| display: flex; | ||
| width: 200px; | ||
| height: 200px; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .ImageAuthor { | ||
| border-radius: 50%; | ||
| width: 50px; | ||
| height: 50px; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 👍