Skip to content

Commit a9bc29d

Browse files
authored
Merge pull request #52 from eyalroth/dev
Merge dev to master
2 parents 46b3d3b + 92b5bc1 commit a9bc29d

File tree

22 files changed

+291
-358
lines changed

22 files changed

+291
-358
lines changed

.env.development

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
URL="http://localhost:8000"
2-
GOOGLE_ANALYTICS=UA-141926834-2
2+
GOOGLE_ANALYTICS=UA-141926834-2
3+
AUTO_RELOAD="true"

gatsby-browser.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,9 @@ require("prismjs/plugins/line-numbers/prism-line-numbers.css")
33

44
import littlefoot from 'littlefoot'
55
import './src/assets/scss/littlefoot.scss'
6-
import './src/assets/scss/_progress.scss'
76
import './src/assets/fonts/fontello/css/fontello.css'
87

9-
export const onServiceWorkerUpdateReady = () => {
10-
const answer = window.confirm(
11-
`This application has been updated. ` +
12-
`Reload to display the latest version?`
13-
)
14-
15-
if (answer === true) {
16-
window.location.reload()
17-
}
18-
}
19-
20-
export function onRouteUpdate({ location }) {
8+
export function onRouteUpdate() {
219
addLittlefoot()
2210
}
2311

gatsby-config.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,15 @@ module.exports = {
182182
`gatsby-plugin-netlify`,
183183
`gatsby-plugin-robots-txt`,
184184
{
185-
resolve: 'gatsby-plugin-page-progress-fork',
185+
resolve: `gatsby-plugin-layout`,
186186
options: {
187-
includePaths: [
188-
{ regex: '^/' },
189-
],
187+
component: require.resolve(`./src/components/Layout/index.jsx`)
190188
}
191189
},
192190
{
193-
resolve: `gatsby-plugin-layout`,
191+
resolve: `gatsby-plugin-browser-reload`,
194192
options: {
195-
component: require.resolve(`./src/components/Layout/index.jsx`)
193+
autoReload: process.env.AUTO_RELOAD
196194
}
197195
},
198196
],

netlify.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
[build.environment]
66
GOOGLE_ANALYTICS = "UA-141926834-2"
7+
AUTO_RELOAD = "false"
78

89
[context.production]
910

1011
[context.production.environment]
11-
GOOGLE_ANALYTICS = "UA-141926834-1"
12+
GOOGLE_ANALYTICS = "UA-141926834-1"
13+
AUTO_RELOAD = "true"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export function onServiceWorkerUpdateReady({}, pluginOptions ) {
2+
3+
const autoReload = pluginOptions.autoReload && pluginOptions.autoReload.toLowerCase() == 'true'
4+
const answer = autoReload || window.confirm(
5+
`This application has been updated. ` +
6+
`Reload to display the latest version?`
7+
)
8+
if (answer === true) {
9+
window.location.reload()
10+
}
11+
}

plugins/gatsby-plugin-page-progress-fork/package.json plugins/gatsby-plugin-browser-reload/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "gatsby-plugin-page-progress-fork",
2+
"name": "gatsby-plugin-browser-reload",
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",

plugins/gatsby-plugin-page-progress-fork/gatsby-browser.js

-128
This file was deleted.

plugins/gatsby-plugin-page-progress-fork/progress.css

-8
This file was deleted.

src/assets/scss/_progress.scss

-12
This file was deleted.

src/assets/scss/_variables.scss

+25-11
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ $sidebar-width-pct: 0.25;
6060
$content-width-pct: 0.65;
6161

6262
$max-layout-width: 1280px;
63-
$bg-width: $max-layout-width - 120px;
64-
$bg-shift: 110px;
65-
$content-max-width: 660px;
63+
$max-content-width: 660px;
64+
$bg-width: round($max-layout-width * 0.9);
6665

6766

6867
// breakpoint - base - handset (portrait)
@@ -79,17 +78,32 @@ $content-width-sm: 92vw;
7978
// breakpoint - md - xlarge tablet (portrait), tablet (landscape), xlarge handset (landscape)
8079
$layout-breakpoint-md: 900px;
8180

82-
$sidebar-width-md: 100vw * $sidebar-width-pct;
83-
$content-width-md: 100vw * $content-width-pct;
81+
$sidebar-width-md: round($layout-breakpoint-md * $sidebar-width-pct);
82+
$content-width-md: round($layout-breakpoint-md * $content-width-pct);
8483

85-
$sidebar-side-margin-md: 30px;
86-
$content-side-padding-md: calc(#{$sidebar-width-md} + #{$sidebar-side-margin-md} + 30px);
84+
$content-side-padding-md: round($max-layout-width * 0.04);
85+
$content-outer-position-md: $content-side-padding-md + $content-width-md;
86+
$content-gap-md: calc(100vw - #{$content-outer-position-md});
87+
$sidebar-side-margin-md: calc(#{$content-outer-position-md} + (#{$content-gap-md} - #{$sidebar-width-md}) / 2);
88+
89+
// breakpoint - xmd
90+
$layout-breakpoint-xmd: $bg-width;
91+
92+
$sidebar-width-xmd: round($layout-breakpoint-xmd * $sidebar-width-pct);
93+
$content-width-xmd: min(round($layout-breakpoint-xmd * $content-width-pct), $max-content-width);
94+
95+
$content-side-padding-xmd: calc(#{$content-side-padding-md} + 2.5vw);
96+
$content-outer-position-xmd: calc(#{$content-side-padding-xmd} + #{$content-width-xmd});
97+
$content-gap-xmd: calc(100vw - #{$content-outer-position-xmd});
98+
$sidebar-side-margin-xmd: calc(#{$content-outer-position-xmd} + (#{$content-gap-xmd} - #{$sidebar-width-xmd}) / 6);
8799

88100
// breakpoint - lg - laptop, xlarge tablet (landscape)
89101
$layout-breakpoint-lg: $max-layout-width;
90102

91-
$sidebar-width-lg: $max-layout-width * $sidebar-width-pct;
92-
$content-width-lg: $max-layout-width * $content-width-pct;
103+
$sidebar-width-lg: round($max-layout-width * $sidebar-width-pct);
104+
$content-width-lg: min(round($max-layout-width * $content-width-pct), $max-content-width);
93105

94-
$content-side-padding-lg: $sidebar-width-lg + $max-layout-width * 0.085;
95-
$sidebar-side-margin-lg: ($content-side-padding-lg - $sidebar-width-lg) / 2.5;
106+
$content-side-padding-lg: round($max-layout-width * 0.1);
107+
$content-outer-position-lg: $content-side-padding-lg + $content-width-lg;
108+
$content-gap-lg: $max-layout-width - $content-outer-position-lg;
109+
$sidebar-side-margin-lg: $content-outer-position-lg + round(($content-gap-lg - $sidebar-width-lg) / 2.5);

src/assets/scss/mixins/_breakpoints.scss

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
}
1919
}
2020

21+
@mixin breakpoint-xmd {
22+
@media screen and (min-width: $layout-breakpoint-xmd) {
23+
@content;
24+
}
25+
}
26+
2127
@mixin breakpoint-lg {
2228
@media screen and (min-width: $layout-breakpoint-lg) {
2329
@content

src/components/Layout/index.jsx

+17-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import ContextConsumer, { ContextProviderComponent } from '../Context'
55
import '../../assets/scss/init.scss'
66
import Sidebar from '../Sidebar'
77
import Footer from '../Footer'
8+
import ProgressBar from '../ProgressBar'
89
import { Languages } from '../../consts/languages'
910
import { Themes } from '../../consts/themes'
1011
import './style.scss'
@@ -17,12 +18,6 @@ class Layout extends React.Component {
1718
render() {
1819
const { children } = this.props
1920

20-
const sidebar = (
21-
<ContextConsumer>
22-
{context => (context.data.sidebar.isRendered) ? <Sidebar /> : null}
23-
</ContextConsumer>
24-
)
25-
2621
const surface0 = (
2722
<div className="surface0"/>
2823
)
@@ -33,6 +28,18 @@ class Layout extends React.Component {
3328
</ContextConsumer>
3429
)
3530

31+
const progressBar = (
32+
<ContextConsumer>
33+
{context => (context.data.sidebar.isRendered) ? <ProgressBar /> : null}
34+
</ContextConsumer>
35+
)
36+
37+
const sidebar = (
38+
<ContextConsumer>
39+
{context => (context.data.sidebar.isRendered) ? <Sidebar /> : null}
40+
</ContextConsumer>
41+
)
42+
3643
return (
3744
<CookiesProvider>
3845
<ContextProviderComponent>
@@ -49,11 +56,14 @@ class Layout extends React.Component {
4956

5057
return (
5158
<div className={`page-container ${languageCss} ${theme.cssClass}`}>
59+
{progressBar}
5260
{surface0}
5361
{surface1}
5462
<div className="content-wrap">
5563
{sidebar}
56-
{children}
64+
<div className="content">
65+
{children}
66+
</div>
5767
</div>
5868
<Footer languageId={context.data.languageId} />
5969
</div>

0 commit comments

Comments
 (0)