Skip to content

Commit

Permalink
replace login information page with React/Material-UI
Browse files Browse the repository at this point in the history
  • Loading branch information
tdtds committed Jul 28, 2017
1 parent 24a5742 commit f34704e
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
5 changes: 5 additions & 0 deletions assets/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ div.container {
}
}

.login-info {
margin-top: 5em;
margin-bottom: 1em;
}

.new-post {
margin: 8px 0px;
padding: 8px;
Expand Down
49 changes: 49 additions & 0 deletions assets/js/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* login - login.js
*
* Copyright (C) 2016 by The wasam@s production
* You can modify and/or distribute this under GPL.
*/
import 'babel-polyfill';
import 'whatwg-fetch';
import * as React from 'react';
import {render} from 'react-dom';
import {Flux} from 'flumpt';
import injectTapEventPlugin from 'react-tap-event-plugin';
import {MuiThemeProvider, RaisedButton} from 'material-ui';
import ImageNavigateNext from 'material-ui/svg-icons/image/navigate-next';
import Footer from './component/footer';
import muiTheme from './theme';

require('../css/default.css');
injectTapEventPlugin();

const main = document.querySelector('#main');
const state = {
};

class Login extends Flux {
render(state) {
return(
<div>
<MuiThemeProvider muiTheme={muiTheme}>
<RaisedButton label="Login with Twitter"
onTouchTap={e => {location.href = "/auth/twitter"}}
primary={true}
icon={<ImageNavigateNext/>}
/>
</MuiThemeProvider>
<Footer/>
</div>
);
}
}

const app = new Login({
renderer: el => {
render(el, main);
},
initialState: state
});
app.update(_initialState => (state));

Empty file removed assets/js/top.js
Empty file.
12 changes: 4 additions & 8 deletions views/login.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
%html
%head
%title login - Massr
%link{rel: "stylesheet", type: "text/css", href: "/css/main.css"}
!= haml :head
%body
!= haml :header
.container-fluid
.row-fluid
.span12
.main
%p<#{_need_login}
%a.btn.btn-large.btn-primary{:href => "/auth/twitter", :title => "Login"}<TwitterでLogin &raquo;
!= haml :footer
%p.login-info<#{_need_login}
.main#main
%script{src: "/js/login.js"}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');

module.exports = {
entry: {
top: './assets/js/top.js',
login: './assets/js/login.js',
main: './assets/js/main.js'
},
output: {
Expand Down

0 comments on commit f34704e

Please sign in to comment.