1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 02:12:53 +00:00

beautified

This commit is contained in:
2016-09-01 13:11:17 +00:00
parent f8ccec7ae0
commit f8c89b4486
16 changed files with 107 additions and 104 deletions

View File

@@ -1,4 +1,4 @@
var width, height, largeHeader, canvas, ctx, circles, target, animateHeader = true; let width, height, largeHeader, canvas, ctx, circles, target, animateHeader = true;
// Main // Main
export function bubble() { export function bubble() {

View File

@@ -2,15 +2,14 @@
flex: 1; flex: 1;
flex-wrap: wrap; flex-wrap: wrap;
min-width: 0; min-width: 0;
.post + .post { .post+ .post {
margin-top: 2em; margin-top: 2em;
} }
.date { .date {
display: block; display: block;
margin: 0; margin: 0;
opacity: 0.7; opacity: 0.7;
@media (min-width: 1200px) {
@media (min-width: 1200px){
position: absolute; position: absolute;
width: 7em; width: 7em;
text-align: right; text-align: right;
@@ -29,7 +28,7 @@
pre { pre {
white-space: pre-wrap; white-space: pre-wrap;
} }
.btn{ .btn {
width: 100%; width: 100%;
} }
} }

View File

@@ -33,7 +33,7 @@ $transitionDuration: 0.4s;
&:before { &:before {
content: " "; content: " ";
display: block; display: block;
background: rgba(0,0,0,0.4); background: rgba(0, 0, 0, 0.4);
position: absolute; position: absolute;
height: 100%; height: 100%;
width: 100vw; width: 100vw;

View File

@@ -1,14 +1,13 @@
@import './utils.scss'; @import './utils.scss';
$linkColor: #3598db; $linkColor: #3598db;
$backgroundColor: #FFFFFF; $backgroundColor: #FFFFFF;
html { html {
font-family: 'Roboto Slab', serif; font-family: 'Roboto Slab', serif;
max-width: 100%; max-width: 100%;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
} }
body { body {
background-color: $backgroundColor; background-color: $backgroundColor;
max-width: 100%; max-width: 100%;
@@ -17,6 +16,7 @@ body {
-webkit-font-smoothing: subpixel-antialiased; -webkit-font-smoothing: subpixel-antialiased;
font-weight: 300; font-weight: 300;
} }
h1, h1,
h2, h2,
h3, h3,
@@ -27,9 +27,11 @@ h6 {
font-weight: 400; font-weight: 400;
line-height: 1em; line-height: 1em;
} }
p { p {
font-weight: 300; font-weight: 300;
} }
*, *,
*:after, *:after,
*:before { *:before {
@@ -37,6 +39,7 @@ p {
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
a { a {
background-color: transparent; background-color: transparent;
color: $linkColor; color: $linkColor;
@@ -45,11 +48,13 @@ a {
color: $linkColor; color: $linkColor;
} }
} }
hr { hr {
margin: 1em; margin: 1em;
border: 0; border: 0;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
.Footer, .Footer,
.Main { .Main {
display: flex; display: flex;
@@ -61,9 +66,11 @@ hr {
width: 1em; width: 1em;
} }
} }
.Main { .Main {
padding-top: 1em; padding-top: 1em;
} }
.Header { .Header {
width: 100%; width: 100%;
background: url("../images/header.jpg"); background: url("../images/header.jpg");
@@ -76,19 +83,20 @@ hr {
text-align: center; text-align: center;
} }
} }
.Loading{
.Loading {
display: flex; display: flex;
flex: 1; flex: 1;
justify-content: center; justify-content: center;
} }
.btn{
.btn {
background-color: $backgroundColor; background-color: $backgroundColor;
border: 1px solid #DADADA; border: 1px solid #DADADA;
border-radius: .2em; border-radius: .2em;
cursor: pointer; cursor: pointer;
padding: .5em; padding: .5em;
&:hover {
&:hover{
background-color: #F3F3F3; background-color: #F3F3F3;
} }
} }

View File

@@ -13,22 +13,22 @@ import * as actions from './redux/actions';
import Index from './pages/Index'; import Index from './pages/Index';
class Main extends React.Component{ class Main extends React.Component {
render(){ render() {
return( return (
<div>{React.cloneElement(this.props.children, this.props)}</div> <div>{React.cloneElement(this.props.children, this.props)}</div>
); );
} }
} }
function mapStateToProps(state){ function mapStateToProps(state) {
return { return {
redux: state.reducer redux: state.reducer
} }
} }
function mapDispatchToProps(dispatch){ function mapDispatchToProps(dispatch) {
return{ return {
actions: bindActionCreators(actions, dispatch) actions: bindActionCreators(actions, dispatch)
} }
} }
@@ -44,4 +44,4 @@ ReactDOM.render((
</Route> </Route>
</Router> </Router>
</Provider> </Provider>
),document.getElementById('app')); ), document.getElementById('app'));

View File

@@ -2,10 +2,10 @@ import React from 'react';
import '../../assets/scss/Footer.scss'; import '../../assets/scss/Footer.scss';
export default class Footer extends React.Component{ export default class Footer extends React.Component {
render(){ render() {
return( return (
<div class="Footer"> <div class="Footer">
Site created and maintained by Mitchell Gerber Site created and maintained by Mitchell Gerber
</div> </div>

View File

@@ -1,13 +1,13 @@
import React from 'react'; import React from 'react';
import {bubble} from '../../assets/js/bubble'; import {bubble} from '../../assets/js/bubble';
export default class Header extends React.Component{ export default class Header extends React.Component {
componentDidMount(){ componentDidMount() {
bubble(); bubble();
} }
render(){ render() {
return( return (
<header id="header" class="Header"> <header id="header" class="Header">
<canvas id="canvas" width="854" height="709"></canvas> <canvas id="canvas" width="854" height="709"></canvas>
</header> </header>

View File

@@ -1,7 +1,7 @@
import hljs from 'highlight.js';
import marked from 'marked';
import React from 'react'; import React from 'react';
import {Link} from 'react-router'; import {Link} from 'react-router';
import marked from 'marked';
import hljs from 'highlight.js';
import '../../assets/scss/Content.scss'; import '../../assets/scss/Content.scss';
@@ -14,10 +14,10 @@ marked.setOptions({
} }
}); });
export default class Post extends React.Component{ export default class Post extends React.Component {
render(){ render() {
return( return (
<div class="Content"> <div class="Content">
<div dangerouslySetInnerHTML={{__html : marked(this.props.content, {renderer : renderer})}}> <div dangerouslySetInnerHTML={{__html : marked(this.props.content, {renderer : renderer})}}>
</div> </div>

View File

@@ -3,11 +3,11 @@ import {Link} from 'react-router';
import '../../assets/scss/Content.scss'; import '../../assets/scss/Content.scss';
export default class Preview extends React.Component{ export default class Preview extends React.Component {
insertPosts(posts){ insertPosts(posts) {
let elements = []; let elements = [];
for (let i = 0; i < this.props.postLimit && i < posts.length; i++){ for (let i = 0; i < this.props.postLimit && i < posts.length; i++) {
elements.push( elements.push(
<div class="post" key={i}> <div class="post" key={i}>
<div class="date"> <div class="date">
@@ -27,7 +27,7 @@ export default class Preview extends React.Component{
return elements; return elements;
} }
render(){ render() {
const posts = this.props.posts; const posts = this.props.posts;
return ( return (

View File

@@ -7,9 +7,9 @@ import SensorList from './sensors/SensorList';
import me from '../../assets/images/me.jpg'; import me from '../../assets/images/me.jpg';
import '../../assets/scss/Sidebar.scss'; import '../../assets/scss/Sidebar.scss';
export default class Sidebar extends React.Component{ export default class Sidebar extends React.Component {
constructor(){ constructor() {
super(); super();
this.state = { this.state = {
@@ -19,7 +19,7 @@ export default class Sidebar extends React.Component{
this.onToggle = this.onToggle.bind(this); this.onToggle = this.onToggle.bind(this);
} }
onToggle(){ onToggle() {
let temp = this.state.toggler; let temp = this.state.toggler;
temp = temp === "open" ? "" : "open"; temp = temp === "open" ? "" : "open";
@@ -28,8 +28,8 @@ export default class Sidebar extends React.Component{
}); });
} }
render(){ render() {
return( return (
<div class={"Sidebar " + this.state.toggler}> <div class={"Sidebar " + this.state.toggler}>
<a onClick={this.onToggle} class="toggler"> <a onClick={this.onToggle} class="toggler">
<i <i

View File

@@ -3,21 +3,21 @@ import 'whatwg-fetch';
export default class SensorList extends React.Component { export default class SensorList extends React.Component {
constructor(){ constructor() {
super(); super();
this.state = { this.state = {
sensors : {}, sensors: {},
fetching: false, fetching: false,
fetched: false fetched: false
} }
} }
componentDidMount(){ componentDidMount() {
this.loadSensorData(); this.loadSensorData();
} }
loadSensorData(){ loadSensorData() {
this.setState({ this.setState({
fetching: true fetching: true
}); });
@@ -49,7 +49,7 @@ export default class SensorList extends React.Component {
</div> </div>
); );
} }
render(){ render() {
return ( return (
<div> <div>
{this.state.fetched ? this.state.sensors.map(this.insertSensorData) : null} {this.state.fetched ? this.state.sensors.map(this.insertSensorData) : null}

View File

@@ -24,12 +24,12 @@ export default class Index extends React.Component {
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps) {
if(this.props.params !== nextProps.params){ if (this.props.params !== nextProps.params) {
const params = nextProps.params; const params = nextProps.params;
this.page = params.page; this.page = params.page;
if(typeof params.post !== 'undefined' && typeof params.category !== 'undefined'){ if (typeof params.post !== 'undefined' && typeof params.category !== 'undefined') {
this.props.actions.fetchPost(params.category, params.post); this.props.actions.fetchPost(params.category, params.post);
} }
} }
@@ -41,7 +41,7 @@ export default class Index extends React.Component {
return ( return (
<div> <div>
<Header /> <Header/>
<div class="Main"> <div class="Main">
{typeof this.page === 'undefined' && !fetching {typeof this.page === 'undefined' && !fetching
? <Preview posts={this.props.redux.preview.posts} ? <Preview posts={this.props.redux.preview.posts}
@@ -50,9 +50,9 @@ export default class Index extends React.Component {
: null} : null}
{this.page === 'post' && !fetching ? <Post content={this.props.redux.post}/> : null} {this.page === 'post' && !fetching ? <Post content={this.props.redux.post}/> : null}
{fetching ? loadingElement : null} {fetching ? loadingElement : null}
<Sidebar /> <Sidebar/>
</div> </div>
<Footer /> <Footer/>
</div> </div>
); );
} }

View File

@@ -2,7 +2,7 @@ import * as types from "./constants";
import marked from 'marked'; import marked from 'marked';
import 'whatwg-fetch'; import 'whatwg-fetch';
export function increasePostLimit(){ export function increasePostLimit() {
return { return {
type: types.INCREASE_POST_LIMIT type: types.INCREASE_POST_LIMIT
} }
@@ -15,15 +15,15 @@ function initPreview(posts) {
} }
} }
function loadPost(post){ function loadPost(post) {
return { return {
type: types.LOAD_POST, type: types.LOAD_POST,
post post
} }
} }
function fetching(){ function fetching() {
return{ return {
type: types.FETCHING type: types.FETCHING
} }
} }

View File

@@ -1,6 +1,6 @@
//constants //constants
export const INCREASE_POST_LIMIT = 'INCREASE_POST_LIMIT';
export const INIT_PREVIEW = 'INIT_PREVIEW'; export const INIT_PREVIEW = 'INIT_PREVIEW';
export const FETCHING = 'FETCHING';
export const FILTER_PREVIEW = 'FILTER_PREVIEW'; export const FILTER_PREVIEW = 'FILTER_PREVIEW';
export const LOAD_POST = 'LOAD_POST'; export const LOAD_POST = 'LOAD_POST';
export const FETCHING = 'FETCHING';
export const INCREASE_POST_LIMIT = 'INCREASE_POST_LIMIT';

View File

@@ -1,10 +1,6 @@
//just using one reducer - use combineReducers from redux to modularize things //just using one reducer - use combineReducers from redux to modularize things
import { import {combineReducers} from 'redux';
combineReducers import {routerReducer} from 'react-router-redux';
} from 'redux';
import {
routerReducer
} from 'react-router-redux';
//import typs //import typs
import * as types from './constants'; import * as types from './constants';
@@ -38,12 +34,12 @@ function reducer(state = defaultState, action) {
}); });
case types.FETCHING: case types.FETCHING:
return Object.assign({}, state, { return Object.assign({}, state, {
fetched : false, fetched: false,
fetching: true fetching: true
}); });
case types.INCREASE_POST_LIMIT: case types.INCREASE_POST_LIMIT:
return Object.assign({}, state, { return Object.assign({}, state, {
postLimit : state.postLimit + 10 postLimit: state.postLimit + 10
}); });
} }

View File

@@ -1,8 +1,8 @@
import {applyMiddleware, createStore} from 'redux';
import {syncHistoryWithStore} from 'react-router-redux';
import {browserHistory} from 'react-router';
import thunk from 'redux-thunk';
import logger from 'redux-logger'; import logger from 'redux-logger';
import thunk from 'redux-thunk';
import {applyMiddleware, createStore} from 'redux';
import {browserHistory} from 'react-router';
import {syncHistoryWithStore} from 'react-router-redux';
import reducers from './reducers'; import reducers from './reducers';