1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-10 09:52:51 +00:00

finished paging

This commit is contained in:
2016-09-01 04:25:58 +00:00
parent 0c531a30c2
commit f8ccec7ae0
8 changed files with 35 additions and 18 deletions

View File

@@ -29,4 +29,7 @@
pre {
white-space: pre-wrap;
}
.btn{
width: 100%;
}
}

View File

@@ -1,6 +1,7 @@
@import './utils.scss';
$linkColor: #3598db;
$backgroundColor: #FFFFFF;
html {
font-family: 'Roboto Slab', serif;
@@ -9,6 +10,7 @@ html {
overflow-y: scroll;
}
body {
background-color: $backgroundColor;
max-width: 100%;
overflow-x: hidden;
position: relative;
@@ -79,3 +81,14 @@ hr {
flex: 1;
justify-content: center;
}
.btn{
background-color: $backgroundColor;
border: 1px solid #DADADA;
border-radius: .2em;
cursor: pointer;
padding: .5em;
&:hover{
background-color: #F3F3F3;
}
}

View File

@@ -7,7 +7,7 @@ export default class Preview extends React.Component{
insertPosts(posts){
let elements = [];
for (let i in posts){
for (let i = 0; i < this.props.postLimit && i < posts.length; i++){
elements.push(
<div class="post" key={i}>
<div class="date">
@@ -22,8 +22,6 @@ export default class Preview extends React.Component{
</p>
</div>
);
if(i >= this.props.postLimit) break;
}
return elements;
@@ -35,6 +33,9 @@ export default class Preview extends React.Component{
return (
<div class="Content">
{posts.length > 0 ? this.insertPosts(posts): null}
{posts.length > this.props.postLimit ?
<button class="btn" onClick={this.props.increasePostLimit.bind(this)}>Load More</button>
: null}
</div>
);
}

View File

@@ -50,7 +50,6 @@ export default class SensorList extends React.Component {
);
}
render(){
console.log(this.state);
return (
<div>
{this.state.fetched ? this.state.sensors.map(this.insertSensorData) : null}

View File

@@ -43,7 +43,11 @@ export default class Index extends React.Component {
<div>
<Header />
<div class="Main">
{typeof this.page === 'undefined' && !fetching ? <Preview posts={this.props.redux.preview.posts} postLimit={this.props.redux.postLimit}/> : null}
{typeof this.page === 'undefined' && !fetching
? <Preview posts={this.props.redux.preview.posts}
postLimit={this.props.redux.postLimit}
increasePostLimit={this.props.actions.increasePostLimit}/>
: null}
{this.page === 'post' && !fetching ? <Post content={this.props.redux.post}/> : null}
{fetching ? loadingElement : null}
<Sidebar />

View File

@@ -6,10 +6,12 @@
"scripts": {
"build": "webpack && babel-node metadata.js",
"c9": "webpack-dev-server --port $PORT --host $IP --hot --content-base dist --history-api-fallback",
"check_gzip_size": "gzip -9 -c ./public/client.min.js | wc -c | numfmt --to=iec-i --suffix=B --padding=10",
"deploy" : "npm run get_dependencies && npm run prod && ./mywebsite",
"dev": "webpack-dev-server --content-base public --inline --hot --history-api-fallback",
"get_dependencies": "npm install & go get ./server",
"prod": "export NODE_ENV=production && webpack -p && babel-node metadata.js && go build ./server/mywebsite.go",
"prod-win": "set NODE_ENV=production && webpack -p && babel-node metadata.js && go build ./server/mywebsite.go",
"deploy" : "npm run prod && ./mywebsite"
"prod-win": "set NODE_ENV=production && webpack -p && babel-node metadata.js && go build ./server/mywebsite.go"
},
"repository": {
"type": "git",

View File

@@ -4,20 +4,17 @@
- Go App Engine
`npm run build` - builds the application using webpack and runs metadata.js
`npm run
- metadata.js recursivly scans the posts folder for markdown files and then parses each into into a json object
- the posts folder is then copied into the dist folder
## TODO
- fix font sizing
- sticky footer
- clean up css
- adjust animations
- fix goapp serve and webpack-dev-server so paths work correctly
- posts page
- fix go and webpack-dev-server so paths work correctly
- add sensor page
- finally do writeups on my projects
- clean go code up
- host on app engine (run mongodb on compute engine???)
- pull everything off digital ocean
- add paging
- finally do writeups on my projects

View File

@@ -31,8 +31,6 @@ func ReadConfig() Config {
log.Printf("%s\n", string(file))
//m := new(Dispatch)
//var m interface{}
var result Config
err := json.Unmarshal(file, &result)