Skip to content
This repository was archived by the owner on Mar 19, 2020. It is now read-only.

Commit b0cd112

Browse files
author
Yuma Soga
committed
#35 Add new desgin template
Bootstrap ベースのテンプレートを使用して制約の多いMDLより自由度を向上させた。
1 parent 099d357 commit b0cd112

23 files changed

+1066
-378
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ gem 'bootsnap'
3939

4040
gem 'pg'
4141

42+
gem 'bootstrap', '~> 4.1.1'
43+
4244
group :development, :test do
4345
gem 'sqlite3'
4446
gem 'byebug'

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,18 @@ GEM
4444
tzinfo (~> 1.1)
4545
addressable (2.4.0)
4646
arel (9.0.0)
47+
autoprefixer-rails (8.6.4)
48+
execjs
4749
backports (3.11.3)
4850
bcrypt (3.1.11)
4951
binding_of_caller (0.8.0)
5052
debug_inspector (>= 0.0.1)
5153
bootsnap (1.3.0)
5254
msgpack (~> 1.0)
55+
bootstrap (4.1.1)
56+
autoprefixer-rails (>= 6.0.3)
57+
popper_js (>= 1.12.9, < 2)
58+
sass (>= 3.5.2)
5359
builder (3.2.3)
5460
byebug (10.0.2)
5561
codeclimate-test-reporter (1.0.8)
@@ -172,6 +178,7 @@ GEM
172178
omniauth-slack (2.3.0)
173179
omniauth-oauth2 (~> 1.3.1)
174180
pg (1.0.0)
181+
popper_js (1.12.9)
175182
pusher-client (0.6.2)
176183
json
177184
websocket (~> 1.0)
@@ -307,6 +314,7 @@ PLATFORMS
307314
DEPENDENCIES
308315
bcrypt (= 3.1.11)
309316
bootsnap
317+
bootstrap (~> 4.1.1)
310318
byebug
311319
codeclimate-test-reporter (~> 1.0.0)
312320
coffee-rails (~> 4.2.1)

app/assets/javascripts/application.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
1111
// about supported directives.
1212
//
13-
//= require jquery
14-
//= require jquery_ujs
13+
//= require rails-ujs
1514
//= require turbolinks
16-
//= require_tree .
15+
//= require jquery3
16+
//= require popper
17+
//= require bootstrap-sprockets
18+
//= require_tree .

app/assets/javascripts/creative.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
(function($) {
2+
"use strict"; // Start of use strict
3+
4+
// Smooth scrolling using jQuery easing
5+
$('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function() {
6+
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
7+
var target = $(this.hash);
8+
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
9+
if (target.length) {
10+
$('html, body').animate({
11+
scrollTop: (target.offset().top - 57)
12+
}, 1000, "easeInOutExpo");
13+
return false;
14+
}
15+
}
16+
});
17+
18+
// Closes responsive menu when a scroll trigger link is clicked
19+
$('.js-scroll-trigger').click(function() {
20+
$('.navbar-collapse').collapse('hide');
21+
});
22+
23+
// Activate scrollspy to add active class to navbar items on scroll
24+
$('body').scrollspy({
25+
target: '#mainNav',
26+
offset: 57
27+
});
28+
29+
// Collapse Navbar
30+
var navbarCollapse = function() {
31+
if ($("#mainNav").offset().top > 100) {
32+
$("#mainNav").addClass("navbar-shrink");
33+
} else {
34+
$("#mainNav").removeClass("navbar-shrink");
35+
}
36+
};
37+
// Collapse now if page is not at top
38+
navbarCollapse();
39+
// Collapse the navbar when page is scrolled
40+
$(window).scroll(navbarCollapse);
41+
42+
// Scroll reveal calls
43+
window.sr = ScrollReveal();
44+
sr.reveal('.sr-icons', {
45+
duration: 600,
46+
scale: 0.3,
47+
distance: '0px'
48+
}, 200);
49+
sr.reveal('.sr-button', {
50+
duration: 1000,
51+
delay: 200
52+
});
53+
sr.reveal('.sr-contact', {
54+
duration: 600,
55+
scale: 0.3,
56+
distance: '0px'
57+
}, 300);
58+
59+
// Magnific popup calls
60+
$('.popup-gallery').magnificPopup({
61+
delegate: 'a',
62+
type: 'image',
63+
tLoading: 'Loading image #%curr%...',
64+
mainClass: 'mfp-img-mobile',
65+
gallery: {
66+
enabled: true,
67+
navigateByImgClick: true,
68+
preload: [0, 1]
69+
},
70+
image: {
71+
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.'
72+
}
73+
});
74+
75+
})(jQuery); // End of use strict

app/assets/stylesheets/application.css renamed to app/assets/stylesheets/application.scss

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@
1010
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
1111
* file per style scope.
1212
*
13-
*= require_tree .
14-
*= require_self
15-
*= require bootstrap-sprockets
16-
*= require bootstrap
17-
*= require font-awesome
1813
*/
19-
body {
20-
background-color: floralwhite;
21-
}
14+
15+
16+
@import "font-awesome";
17+
18+
@import "bootstrap-creative/creative";
19+
20+
@import "bootstrap";
21+
22+
//
23+
// body {
24+
// background-color: floralwhite;
25+
// }
2226
::-webkit-scrollbar{
2327
width: 12px;
2428
}
@@ -31,14 +35,3 @@ body {
3135
border-radius: 1rem;
3236
box-shadow: none;
3337
}
34-
.clearfix:after {
35-
visibility: hidden;
36-
display: block;
37-
content: " ";
38-
clear: both;
39-
height: 0;
40-
}
41-
42-
.mdl-layout__drawer-button {
43-
color: black;
44-
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
// Bootstrap overrides for this template
3+
.text-primary {
4+
color: $primary !important;
5+
}
6+
7+
.btn {
8+
font-weight: 700 !important;
9+
text-transform: uppercase !important;
10+
border: none !important;
11+
border-radius: 300px !important;
12+
@include sans-serif-font;
13+
}
14+
15+
.btn-xl {
16+
padding: 1rem 2rem !important;
17+
}
18+
19+
.btn-primary {
20+
background-color: $primary !important;
21+
border-color: $primary !important;
22+
&:hover,
23+
&:focus,
24+
&:active {
25+
color: $white;
26+
background-color: darken($primary, 5%) !important;
27+
}
28+
&:active,
29+
&:focus {
30+
box-shadow: 0 0 0 0.2rem rgba(240, 95, 64,.5) !important;
31+
}
32+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
// Global styling for this template
3+
body,
4+
html {
5+
width: 100%;
6+
height: 100%;
7+
}
8+
9+
body {
10+
@include serif-font;
11+
}
12+
13+
hr {
14+
max-width: 50px;
15+
border-width: 3px;
16+
border-color: $primary;
17+
}
18+
19+
hr.light {
20+
border-color: $white;
21+
}
22+
23+
a {
24+
color: $primary;
25+
@include transition-all;
26+
&:hover {
27+
color: darken($primary, .1);
28+
}
29+
}
30+
31+
h1,
32+
h2,
33+
h3,
34+
h4,
35+
h5,
36+
h6 {
37+
@include sans-serif-font;
38+
}
39+
40+
.bg-primary {
41+
background-color: $primary !important;
42+
}
43+
44+
.bg-dark {
45+
background-color: $gray-900 !important;
46+
}
47+
48+
.text-faded {
49+
color: fade-out($white, .3);
50+
}
51+
52+
section {
53+
padding: 8rem 0;
54+
}
55+
56+
.section-heading {
57+
margin-top: 0;
58+
}
59+
60+
::-moz-selection {
61+
color: $white;
62+
background: $gray-900;
63+
text-shadow: none;
64+
}
65+
66+
::selection {
67+
color: $white;
68+
background: $gray-900;
69+
text-shadow: none;
70+
}
71+
72+
img::selection {
73+
color: $white;
74+
background: transparent;
75+
}
76+
77+
img::-moz-selection {
78+
color: $white;
79+
background: transparent;
80+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
// Styling for the masthead
3+
header.masthead {
4+
padding-top: 10rem;
5+
padding-bottom: calc(10rem - 56px);
6+
background-image: linear-gradient(rgba(0, 0, 0, .3), rgba(0, 0, 0, .3)), image-url('coderdojo-konan-header-image-1.jpg');
7+
background-position: center center;
8+
@include background-cover;
9+
hr {
10+
margin-top: 30px;
11+
margin-bottom: 30px;
12+
}
13+
h1 {
14+
font-size: 2rem;
15+
}
16+
p {
17+
font-weight: 300;
18+
}
19+
@media (min-width: 768px) {
20+
p {
21+
font-size: 1.15rem;
22+
}
23+
}
24+
@media (min-width: 992px) {
25+
height: 100vh;
26+
min-height: 650px;
27+
padding-top: 0;
28+
padding-bottom: 0;
29+
h1 {
30+
font-size: 3rem;
31+
}
32+
}
33+
@media (min-width: 1200px) {
34+
h1 {
35+
font-size: 4rem;
36+
}
37+
}
38+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Mixins
2+
@mixin transition-all() {
3+
-webkit-transition: all 0.2s;
4+
-moz-transition: all 0.2s;
5+
transition: all 0.2s;
6+
}
7+
@mixin background-cover() {
8+
-webkit-background-size: cover;
9+
-moz-background-size: cover;
10+
-o-background-size: cover;
11+
background-size: cover;
12+
}
13+
@mixin serif-font() {
14+
font-family: 'Merriweather', 'Helvetica Neue', Arial, sans-serif;
15+
}
16+
@mixin sans-serif-font() {
17+
font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
18+
}

0 commit comments

Comments
 (0)