diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..d2609ca --- /dev/null +++ b/.babelrc @@ -0,0 +1,17 @@ +{ + "presets":[ + "es2015", "react" + ], + "env": { + "development": { + "presets": ["es2015", "react", "stage-0"], + "plugins": ["transform-runtime"], + "presets": ["react-hmre"] + } + }, + "env": { + "build": { + "presets": ["es2015", "react", "stage-0"] + } + } +} diff --git a/.gitignore b/.gitignore index 5148e52..6c4d523 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,7 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories node_modules -jspm_packages - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history +dist +public +*.log +content +renders +data.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..cd651e3 --- /dev/null +++ b/package.json @@ -0,0 +1,55 @@ +{ + "name": "portfolio", + "version": "1.0.0", + "description": "portfolio", + "main": "index.js", + "scripts": { + "build": "NODE_ENV=production babel src --out-dir dist --copy-files && webpack -p --progress --config webpack.prod.config.js", + "start": "NODE_ENV=production node ./src/server.js", + "dev": "NODE_ENV=development babel-node ./src/server.js --presets es2015,stage-2 ./srcserver.js" + }, + "keywords": [ + "porfolio", + "react" + ], + "author": "Matúš Námešný", + "license": "ISC", + "dependencies": { + "async": "^2.5.0", + "axios": "^0.17.0", + "express": "^4.13.4", + "front-matter": "^2.2.0", + "jsonfile": "^4.0.0", + "markdown-it": "^8.4.0", + "moment": "^2.19.1", + "node-sass": "^4.9.0", + "react": "^15.0.1", + "react-dom": "^15.0.1", + "react-router-dom": "^4.1.1" + }, + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.7.6", + "babel-jest": "*", + "babel-loader": "^7.1.4", + "babel-plugin-transform-runtime": "^6.7.5", + "babel-polyfill": "^6.26.0", + "babel-preset-es2015": "^6.6.0", + "babel-preset-react": "^6.5.0", + "babel-preset-react-hmre": "^1.1.1", + "babel-preset-stage-0": "^6.5.0", + "babel-register": "^6.7.2", + "babel-runtime": "^6.26.0", + "css-loader": "^0.28.11", + "css-modules-require-hook": "^4.0.6", + "file-loader": "^1.1.11", + "postcss-loader": "^2.1.4", + "sass-loader": "^7.0.1", + "style-loader": "^0.21.0", + "url-loader": "^0.5.9", + "webpack": "^4.7.0", + "webpack-cli": "^2.1.2", + "webpack-dev-middleware": "^3.1.3", + "webpack-hot-middleware": "^2.18.0" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..f053ebf --- /dev/null +++ b/postcss.config.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/src/app-client.js b/src/app-client.js new file mode 100644 index 0000000..a194113 --- /dev/null +++ b/src/app-client.js @@ -0,0 +1,17 @@ +import React from 'react'; +import {render} from 'react-dom'; +import {BrowserRouter as Router} from 'react-router-dom'; +import {App} from './components'; + +const AppClient = () => ( + + + +) + +window.onload = () => { + render( + , + document.getElementById('root') + ); +}; diff --git a/src/components/About.js b/src/components/About.js new file mode 100644 index 0000000..dc2a884 --- /dev/null +++ b/src/components/About.js @@ -0,0 +1,26 @@ +import React, {Component} from 'react'; +import {Spinner, Header} from '.'; +import '../static/stylesheets/globals.scss'; +import styles from './About.scss'; +import contentStyle from '../static/stylesheets/content.scss'; + +export default class About extends Component { + + render () { + if (this.props.isLoading) { + return ( +
+ +
+ ); + } + + return ( +
+
+
+
+
+ ) + } +} diff --git a/src/components/About.scss b/src/components/About.scss new file mode 100644 index 0000000..2ed6ea5 --- /dev/null +++ b/src/components/About.scss @@ -0,0 +1 @@ +@import "../static/stylesheets/variables.scss"; diff --git a/src/components/App.js b/src/components/App.js new file mode 100644 index 0000000..316d82b --- /dev/null +++ b/src/components/App.js @@ -0,0 +1,16 @@ +import React from 'react'; +import { Route, Switch } from 'react-router-dom'; +import { Home, NotFoundWrapper } from '.'; +import { MainContainer, PostContainer } from '../containers'; + +export const App = () => ( +
+ + + + + +
+); + +export default App; diff --git a/src/components/Blog.js b/src/components/Blog.js new file mode 100644 index 0000000..b119f76 --- /dev/null +++ b/src/components/Blog.js @@ -0,0 +1,42 @@ +import React, {Component} from 'react'; +import {Spinner, Header} from '.'; +import '../static/stylesheets/globals.scss'; +import styles from './Blog.scss'; +import contentStyle from '../static/stylesheets/content.scss'; + +export default class Blog extends Component { + + render() { + if (this.props.isLoading) { + return ( +
+ +
+ ); + } + + let posts = this.props.posts.map((post) => +
+
+
+ {post.published} + {post.title} +
+
+
+ ) + + return ( +
+
+ +
+
+ {posts} +
+
+ +
+ ); + } +}; diff --git a/src/components/Blog.scss b/src/components/Blog.scss new file mode 100644 index 0000000..5c85921 --- /dev/null +++ b/src/components/Blog.scss @@ -0,0 +1,29 @@ +@import "../static/stylesheets/variables.scss"; + +.post { + display: inline-block; + float: left; + span { + margin-right: 30px; + } + a { + color: $blue; + text-decoration: none; + text-transform: capitalize; + font-family: $font-header; + font-size: 1.2em; + } +} + +.postsWrapper { + margin-top: 20px; +} + +.postHeader { + overflow: hidden; + padding: 0 5px 0 5px; +} + +.postListItem { + margin: 8px; +} diff --git a/src/components/Header.js b/src/components/Header.js new file mode 100644 index 0000000..0137c4b --- /dev/null +++ b/src/components/Header.js @@ -0,0 +1,14 @@ +import React, {Component} from 'react'; +import '../static/stylesheets/globals.scss'; +import styles from './Header.scss'; + +export default class Header extends Component { + + render () { + return ( +
+

{this.props.header}

+
+ ) + } +} diff --git a/src/components/Header.scss b/src/components/Header.scss new file mode 100644 index 0000000..197f916 --- /dev/null +++ b/src/components/Header.scss @@ -0,0 +1,11 @@ +@import "../static/stylesheets/variables.scss"; + +.mainHeader { + border-left: 5px solid $blue; + padding: 5px; + margin: 0; + text-align: left; + h1 { + margin: 0; + } +} diff --git a/src/components/Home.js b/src/components/Home.js new file mode 100644 index 0000000..f19d729 --- /dev/null +++ b/src/components/Home.js @@ -0,0 +1,58 @@ +import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; +import config from '../utils/config.json'; +import '../static/stylesheets/globals.scss'; +import styles from './Home.scss'; + +export default class Home extends Component { + + render() { + let key = 0; + const objKeys = Object.keys(config.social); + + const socialLinks = objKeys.map((val) => { + const link = ( + +