Skip to content

Commit 61ef565

Browse files
committed
added login | main layout materialize cdn
1 parent ae4a510 commit 61ef565

File tree

8 files changed

+80
-18
lines changed

8 files changed

+80
-18
lines changed

story-books/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.env
2+
node_modules

story-books/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const express = require('express');
2-
const path = require('path');
32
const morgan = require('morgan');
3+
const path = require('path');
44
const exphbs = require('express-handlebars');
55
const methodOverride = require('method-override');
66
const dotenv = require('dotenv');
@@ -54,7 +54,10 @@ if (process.env.NODE_ENV === 'development') {
5454
app.set('view engine', '.hbs');
5555
}
5656

57-
app.use('/', require('./routes/index'))
57+
// static file
58+
app.use(express.static(path.join(__dirname, 'public')));
59+
60+
app.use('/', require('./routes/index'));
5861

5962
const port = process.env.PORT || 3000;
6063
app.listen(

story-books/public/css/style.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
p {
2+
margin: 10px 0 !important;
3+
}
4+
5+
.login-container {
6+
width: 400px;
7+
margin-top: 50px;
8+
text-align: center;
9+
}
10+
11+
.fa-small {
12+
font-size: 16px !important;
13+
}
14+
15+
.btn-float {
16+
float: left;
17+
margin-right: 10px;
18+
}
19+
20+
.img-small {
21+
width: 180px;
22+
}

story-books/routes/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ router.get('/', (req, res) => {
77
// res.render('login', {
88
// layout: 'login',
99
// });
10-
res.send('Login Page');
10+
res.render('login', {
11+
layout: 'login'
12+
});
1113
});
1214

1315
// @desc dashboard
1416
// @route GET /dashboard
1517
router.get('/dashboard', (req, res) => {
16-
res.send('Dashboard Page');
18+
res.render('dashboard');
1719
});
1820
// router.get('/dashboard', ensureAuth, async (req, res) => {
1921
// try {

story-books/views/dashboard.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>Dashboard</h1>

story-books/views/layouts/login.hbs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
{{!-- materialize ui cdn --}}
8+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
9+
10+
{{!-- font-awesome cdn --}}
11+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css"
12+
integrity="sha256-46r060N2LrChLLb5zowXQ72/iKKNiw/lAmygmHExk/o=" crossorigin="anonymous" />
13+
14+
{{!-- static styles css file --}}
15+
<link rel="stylesheet" href="/css/style.css">
16+
<title>Story Books Loing</title>
17+
</head>
18+
19+
<body>
20+
21+
<div class="container login-container">
22+
<div class="card">
23+
<div class="card-content">
24+
{{{body}}}
25+
</div>
26+
</div>
27+
</div>
28+
29+
30+
{{!-- javascript --}}
31+
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
32+
<script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.14.1/ckeditor.js"
33+
integrity="sha256-bEIQpI72w9NJuIVhTLFUF2/8uxl0u5800r8ddViuv+o=" crossorigin="anonymous"></script>
34+
</body>
35+
36+
</html>

story-books/views/layouts/main.hbs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +0,0 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
3-
4-
<head>
5-
<meta charset="UTF-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Story Books</title>
8-
</head>
9-
10-
<body>
11-
{{{body}}}
12-
</body>
13-
14-
</html>

story-books/views/login.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<h3><i class="fas fa-book-reader"></i> StoryBooks</h3>
2+
<div class="section">
3+
<p class="lead">Create public and private stories from your life.</p>
4+
</div>
5+
<div class="divider"></div>
6+
<div class="section">
7+
<a href="/auth/google" class="btn red darken-1">
8+
<i class="fab fa-google left"></i> Log In With Google
9+
</a>
10+
</div>

0 commit comments

Comments
 (0)