Skip to content

Commit 38aef6d

Browse files
authored
Merge pull request #7 from corgicode/feature/1-header
#1 fixed css problems, created a header component
2 parents fc40fb1 + 113b4f7 commit 38aef6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2860
-2778
lines changed

config/webpack.config.common.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
{
1313
loader: 'css-loader',
1414
options: {
15-
modules: true,
15+
modules: false,
1616
localIdentName: 'assets/[name]---[local]---[hash:base64:5]',
1717
}
1818
},
@@ -26,7 +26,6 @@ module.exports = {
2626
},
2727
{ test: /\.woff(2)?(\?[a-z0-9#=&.]+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
2828
{ test: /\.(ttf|eot|svg)(\?[a-z0-9#=&.]+)?$/, loader: 'file-loader?name=assets/fonts/[name].[ext]' },
29-
{ test: /\.(gif|jpg|png)(\?[a-z0-9#=&.]+)?$/, loader: 'file-loader?name=assets/images/[name].[ext]' }
3029
],
3130
}
3231
};

config/webpack.config.prod.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const paths = require('./paths');
1414
const getClientEnvironment = require('./env');
1515
const commonConfig = require('./webpack.config.common');
1616
const merge = require('webpack-merge');
17+
const CnameWebpackPlugin = require('cname-webpack-plugin');
1718

1819
// Webpack uses `publicPath` to determine where the app is being served from.
1920
// It requires a trailing slash, or the file assets will get an incorrect path.
@@ -214,6 +215,7 @@ module.exports = merge(commonConfig, {
214215
),
215216
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
216217
},
218+
{ test: /CNAME?$/, loader: 'file-loader?name=CNAME' },
217219
],
218220
},
219221
],
@@ -314,6 +316,9 @@ module.exports = merge(commonConfig, {
314316
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
315317
// You can remove this if you don't use Moment.js:
316318
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
319+
new CnameWebpackPlugin({
320+
___domain: 'frontend.codecorgi.co',
321+
}),
317322
],
318323
// Some libraries import Node modules but don't use them in the browser.
319324
// Tell Webpack to provide empty mocks for them so importing them works.

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"babel-runtime": "6.26.0",
2727
"case-sensitive-paths-webpack-plugin": "2.1.1",
2828
"chalk": "1.1.3",
29+
"cname-webpack-plugin": "^1.0.1",
2930
"dotenv": "4.0.0",
3031
"es6-promise": "^4.1.1",
3132
"eslint-config-react-app": "^2.0.1",

src/challenges/0/homepage.png

3.24 MB
Loading

src/challenges/1/desktop.png

44.4 KB
Loading

src/challenges/1/mobile.png

29.7 KB
Loading

src/components/header/index.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
import logoTextHover from '../../images/logo-text-hover.png';
4+
import logoText from '../../images/logo-text.png';
5+
import '../../styles/_header.scss';
6+
7+
class Header extends React.Component {
8+
constructor(props) {
9+
super(props);
10+
this.mouseOver = this.mouseOver.bind(this);
11+
this.mouseOut = this.mouseOut.bind(this);
12+
this.toggleVisibility = this.toggleVisibility.bind(this);
13+
this.state = {
14+
hover: false,
15+
visible: false,
16+
};
17+
}
18+
19+
mouseOver = () => {
20+
this.setState({hover: true});
21+
}
22+
mouseOut() {
23+
this.setState({hover: false});
24+
}
25+
26+
toggleVisibility() {
27+
this.setState({ visible: !this.state.visible });
28+
}
29+
30+
render() {
31+
return (<header className="header">
32+
<div className="navbar">
33+
<div className="navbar-header">
34+
<div className="container">
35+
<ul className="social pull-right">
36+
{/* <li><a href="#"><i class="icon-s-facebook"></i></a></li>
37+
<li><a href="#"><i class="icon-s-gplus"></i></a></li>
38+
<li><a href="#"><i class="icon-s-twitter"></i></a></li>
39+
<li><a href="#"><i class="icon-s-pinterest"></i></a></li>
40+
<li><a href="#"><i class="icon-s-behance"></i></a></li>
41+
<li><a href="#"><i class="icon-s-dribbble"></i></a></li>*/}
42+
</ul>
43+
<Link className="navbar-brand" onClick={this.toggleVisibility} to="/">
44+
{this.state.hover && <img src={logoTextHover} width="168" className="logo" alt="codecorgi logo" onMouseEnter={this.mouseOver} onMouseLeave={this.mouseOut} />}
45+
{!this.state.hover && <img src={logoText} width="168" className="logo" alt="codecorgi logo" onMouseEnter={this.mouseOver} onMouseLeave={this.mouseOut} />}
46+
</Link>
47+
<a className="navbar-toggle btn responsive-menu pull-right red-button" onClick={this.toggleVisibility}><i className="icon-menu-1"/></a>
48+
</div>
49+
</div>
50+
<div className="yamm">
51+
<div className={'navbar-collapse visible-md visible-lg' + (this.state.visible ? 'visible-sm visible-xs' : '')}>
52+
<div className="container">
53+
<Link className="navbar-brand" onClick={this.toggleVisibility} to="/">
54+
{this.state.hover && <img src={logoTextHover} className="logo" alt="codecorgi logo" onMouseEnter={this.mouseOver} onMouseLeave={this.mouseOut} />}
55+
{!this.state.hover && <img src={logoText} className="logo" alt="codecorgi logo" onMouseEnter={this.mouseOver} onMouseLeave={this.mouseOut} />}
56+
</Link>
57+
<ul className="nav navbar-nav">
58+
<li>
59+
<Link to="/challenges" onClick={this.toggleVisibility}>Challenges</Link>
60+
</li>
61+
<li>
62+
<Link className="red-button" to="/app#!/signup" onClick={this.toggleVisibility}>Account</Link>
63+
</li>
64+
</ul>
65+
</div>
66+
</div>
67+
</div>
68+
</div>
69+
</header>);
70+
}
71+
}
72+
73+
export default Header;

src/containers/app/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import React from 'react';
2-
import { Route, Link } from 'react-router-dom';
2+
import { Route } from 'react-router-dom';
33
import Home from '../home';
44
import About from '../about';
5-
import '../../styles/main.scss';
5+
import Header from '../../components/header';
66

77
const App = () => (
88
<div>
9-
<header>
10-
<Link to="/">Home</Link>
11-
<Link to="/about-us">About</Link>
12-
</header>
13-
9+
<Header />
1410
<main>
1511
<Route exact path="/" component={Home} />
1612
<Route exact path="/about-us" component={About} />

src/homepage/1-ticket-start.png

106 KB
Loading

0 commit comments

Comments
 (0)