Skip to content
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

Feature/display image #1

Merged
merged 2 commits into from
Sep 30, 2016
Merged
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
11 changes: 11 additions & 0 deletions js/components/Image/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { Component } from 'react'

export default class Image extends Component {
render() {
return (
<section className={this.props.className}>
<img src={this.props.file} />
</section>
)
}
}
3 changes: 3 additions & 0 deletions js/components/Image/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import component from './component'

export default component
Empty file added js/components/Image/styles.css
Empty file.
Binary file added js/pages/Main/assets/big_cat.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions js/pages/Main/component.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from 'react'
import Links from '../../components/Links'
import Image from '../../components/Image'
import bigCat from './assets/big_cat.jpeg'
import styles from './styles.css'

class Main extends React.Component {
render() {
return (
<div>
<Links />
{this.props.children}
<Image className={styles.imageSize} file={bigCat} />
</div>
)
}
Expand Down
5 changes: 5 additions & 0 deletions js/pages/Main/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.body {
background: blue;
}

.imageSize img {
max-height: 200px;
max-width: 200px;
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"devDependencies": {
"autoprefixer": "^6.5.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.22.0",
"jsx-loader": "^0.13.2",
"postcss-loader": "^0.13.0",
Expand Down
4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ module.exports = {
),
include: __dirname + '/js'
},
{
test: /\.jpeg$/,
loader: 'file-loader'
},
{
test: /\.js$/,
exclude: /node_modules/,
Expand Down