Skip to content

Commit

Permalink
add images for slider, file-loader config
Browse files Browse the repository at this point in the history
  • Loading branch information
trukhilio committed Jul 26, 2017
1 parent f9de929 commit 24de985
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 19 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Memories_app</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<script>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"css-loader": "0.23.1",
"express": "4.13.4",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "0.11.2",
"isomorphic-style-loader": "3.0.0",
"node-sass": "4.5.3",
"npm-install-webpack-plugin": "2.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';

import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from '../styles/button.scss';
import s from './styles.scss';

export class Button extends Component{
render(){
Expand Down
3 changes: 3 additions & 0 deletions src/components/button/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.btncolor {
color: blueviolet;
}
16 changes: 16 additions & 0 deletions src/components/image/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { Component } from 'react';

import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './styles.scss';

export class Image extends Component{
render(){
return(
<img
src={this.props.src}
alt="image here"/>
)
}
}

export default withStyles(s)(Image);
Empty file.
12 changes: 5 additions & 7 deletions src/components/page.js → src/components/page/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { PropTypes, Component } from 'react';

import Button from './button';
import Button from '../button/index';
import Image from '../image/index';

export default class Page extends Component {

Expand All @@ -21,12 +22,9 @@ export default class Page extends Component {
{buttonArr.map((item, index) =>
<Button key={index} title={item} onClick={e => {e.preventDefault();filterPhotos(item)}}/>)}
{photos.map((entry, index) =>
<div key={index}>
<img src={entry.source}
width="300"
height="auto"
/>
</div>)}
<div key={index}>
<Image src={entry.source} />
</div>)}
</div>;
return (
<div>
Expand Down
3 changes: 3 additions & 0 deletions src/components/user/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.user__appName{
color: palevioletred;
}
20 changes: 16 additions & 4 deletions src/components/user.js → src/components/user/user.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
import React, { PropTypes, Component } from 'react';

import Button from './button';
import Button from '../button/index';
import Image from '../image/index';
import s from './styles.scss';

const pathToImages = require.context('../../picture/slider', true);

export default class User extends Component {
render(){
const { content, error } = this.props;
const srcImage = pathToImages.keys().map(pathToImages);
let template;
if (content){
template =
<div>
<p>
Welcome, {content.username}!
</p>
<img src={content.avatar} />
<Image src={content.avatar} />
<Button title="Say goodbye!" onClick={this.props.handleLogout}/>
</div>
} else {
template =
<div>
{srcImage.map((item, index)=>
<div key={index}>
<Image src={item} />
</div>)}
<h2 className={s.user__appName}>
memories
</h2>
<p>
Hello, stranger! Welcome to memories app, press Login button for enter the app. App is using facebook account.
Hello my friend! Welcome to memories app, press Login button for enter the app. App is using facebook account.
</p>
<Button title="Login" onClick={this.props.handleLogin}/>
<Button title="Login via Facebook" onClick={this.props.handleLogin}/>
</div>
}
return (
Expand Down
4 changes: 2 additions & 2 deletions src/containers/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

import User from '../components/user';
import Page from '../components/page';
import User from '../components/user/user';
import Page from '../components/page/page';
import * as pageActions from '../actions/pageAction';
import * as userActions from '../actions/userAction';

Expand Down
Binary file added src/picture/slider/photo_one.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/picture/slider/photo_three.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/picture/slider/photo_two.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/styles/button.scss

This file was deleted.

3 changes: 2 additions & 1 deletion src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
body {
background-color: lightgoldenrodyellow;
margin: 0 auto;
}




4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ module.exports = {
'css-loader?modules&localIdentName=[name]_[local]_[hash:base64:3]',
'postcss-loader'
]
},
{
test: /\.(png|jpe?g|gif)$/,
loader: "file-loader?name=img/img-[hash:6].[ext]"
}
]
},
Expand Down

0 comments on commit 24de985

Please sign in to comment.