Skip to content

Commit

Permalink
Merge pull request #1 from spartansystems/feature/display-image
Browse files Browse the repository at this point in the history
Feature/display image
  • Loading branch information
samcdavid authored Sep 30, 2016
2 parents e196d3d + 5521f7a commit e4256e7
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 0 deletions.
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

0 comments on commit e4256e7

Please sign in to comment.