Skip to content

Commit 410d568

Browse files
authored
Merge pull request #36 from eyalroth/dev
Merge dev to master
2 parents 5b5f532 + c2062dd commit 410d568

File tree

71 files changed

+831
-423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+831
-423
lines changed

gatsby-browser.js

+149-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import littlefoot from 'littlefoot'
55
import 'littlefoot/dist/littlefoot.css'
66
import './src/assets/scss/_progress.scss'
77

8+
var sidebarState = "main"
9+
var lastUnderlineLink = null
10+
811
export const onServiceWorkerUpdateReady = () => {
912
const answer = window.confirm(
1013
`This application has been updated. ` +
@@ -16,7 +19,12 @@ export const onServiceWorkerUpdateReady = () => {
1619
}
1720
}
1821

19-
export function onRouteUpdate() {
22+
export function onRouteUpdate({ location }) {
23+
addLittlefoot()
24+
addSidebarCollapse(location)
25+
}
26+
27+
function addLittlefoot() {
2028
const bt = `
2129
<button
2230
aria-controls="fncontent:<%= id %>"
@@ -31,4 +39,144 @@ export function onRouteUpdate() {
3139
</button>
3240
`
3341
littlefoot({buttonTemplate: bt})
42+
}
43+
44+
function addSidebarCollapse(location) {
45+
46+
if (location.pathname == "/") {
47+
sidebarState = "main"
48+
lastUnderlineLink = null
49+
}
50+
51+
if (document.getElementById("sidebar")) {
52+
const menu = document.getElementById("sidebar__menu")
53+
const menuButton = document.getElementById("sidebar__menu-button")
54+
const menuLinks = document.getElementsByClassName("sidebar__menu-list-item-link")
55+
const menuUnderline = document.getElementById("sidebar__menu-underline")
56+
57+
const contact = document.getElementById("sidebar__contact")
58+
const contactButton = document.getElementById("sidebar__contact-button")
59+
60+
const profileImage = document.getElementById("sidebar__author-img")
61+
const authorTitle = document.getElementById("sidebar__author-title")
62+
63+
setSidebarState(sidebarState)
64+
setupUnderline(location)
65+
66+
menuButton.addEventListener("click", () => toggle("menu-button"))
67+
contactButton.addEventListener("click", () => toggle("contact-button"))
68+
69+
function toggle(buttonClicked) {
70+
if (buttonClicked == "menu-button") {
71+
if (sidebarState == "menu") {
72+
setSidebarState("main")
73+
} else {
74+
setSidebarState("menu")
75+
}
76+
} else if (buttonClicked == "contact-button") {
77+
if (sidebarState == "contact") {
78+
setSidebarState("main")
79+
} else {
80+
setSidebarState("contact")
81+
}
82+
}
83+
}
84+
85+
function setSidebarState(state) {
86+
87+
sidebarState = state
88+
89+
if (state == "main") {
90+
enable(profileImage)
91+
enable(authorTitle)
92+
disable(menu)
93+
disable(menuButton)
94+
disable(contact)
95+
disable(contactButton)
96+
} else if (state == "menu") {
97+
disable(profileImage)
98+
disable(authorTitle)
99+
enable(menu)
100+
enable(menuButton)
101+
disable(contact)
102+
disable(contactButton)
103+
} else if (state == "contact") {
104+
enable(profileImage)
105+
disable(authorTitle)
106+
disable(menu)
107+
disable(menuButton)
108+
enable(contact)
109+
enable(contactButton)
110+
}
111+
}
112+
113+
function setupUnderline(location) {
114+
115+
const lastLink = findMatchingLink(lastUnderlineLink)
116+
const currentLink = findMatchingLink(location)
117+
118+
if (currentLink) {
119+
if (lastLink) {
120+
setUnderline(lastLink)
121+
shiftUnderline({from: lastLink, to: currentLink})
122+
} else {
123+
if (menu.getBoundingClientRect().width > 0) {
124+
setUnderline(currentLink)
125+
} else {
126+
menuButton.addEventListener('click', () => {
127+
menu.addEventListener('transitionend', () => {
128+
setUnderline(currentLink)
129+
}, {once: true})
130+
}, {once: true})
131+
}
132+
}
133+
lastUnderlineLink = currentLink
134+
} else {
135+
lastUnderlineLink = null
136+
}
137+
138+
function setUnderline(link) {
139+
const { left, width } = link.getBoundingClientRect()
140+
menuUnderline.style.left = `${left}px`
141+
menuUnderline.style.width = `${width}px`
142+
}
143+
144+
function shiftUnderline({from, to}) {
145+
const { left: fromX } = from.getBoundingClientRect()
146+
const { left: toX, width } = to.getBoundingClientRect()
147+
menuUnderline.style.transform = `translateX(${toX - fromX}px)`
148+
menuUnderline.style.width = `${width}px`
149+
}
150+
}
151+
152+
function enable(item) {
153+
item.classList.add(`${item.id}-enabled`)
154+
item.classList.remove(`${item.id}-disabled`)
155+
}
156+
157+
function disable(item) {
158+
item.classList.add(`${item.id}-disabled`)
159+
item.classList.remove(`${item.id}-enabled`)
160+
}
161+
162+
function findMatchingLink(location) {
163+
164+
if (location == null) {
165+
return null
166+
}
167+
168+
for (let i = 0; i < menuLinks.length; i++) {
169+
let link = menuLinks[i]
170+
if (noTrailingSlash(link.pathname) == noTrailingSlash(location.pathname)) {
171+
return link
172+
}
173+
}
174+
175+
return null
176+
177+
function noTrailingSlash(pathname) {
178+
return pathname.replace(/\/$/, "")
179+
}
180+
}
181+
}
34182
}

gatsby-config.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ module.exports = {
2121
utterances: 'eyalroth/blog-gatsby-comments',
2222
author: {
2323
name: 'Eyal Roth',
24-
linkedin: "#",
25-
github: '#',
26-
email: '#',
24+
linkedin: "https://linkedin.com/in/eyal-roth",
25+
github: 'https://github.com/eyalroth',
26+
email: 'eyalroth1@gmail.com',
2727
},
2828
},
2929
plugins: [
@@ -34,6 +34,13 @@ module.exports = {
3434
path: path.join(__dirname, `src`, `pages`),
3535
},
3636
},
37+
{
38+
resolve: 'gatsby-source-filesystem',
39+
options: {
40+
name: 'pages',
41+
path: path.join(__dirname, `src`, `posts`),
42+
},
43+
},
3744
{
3845
resolve: 'gatsby-source-filesystem',
3946
options: {
@@ -123,12 +130,12 @@ module.exports = {
123130
resolve: `gatsby-plugin-manifest`,
124131
options: {
125132
name: `Eyal Roth`,
126-
short_name: `EyalRoth`,
133+
short_name: `Eyal Roth`,
127134
start_url: `/`,
128135
background_color: `#f7f0eb`,
129136
theme_color: `#a2466c`,
130137
display: `standalone`,
131-
icon: `src/images/icon.png`
138+
icon: `src/images/icon2.png`
132139
},
133140
},
134141
`gatsby-plugin-offline`,

gatsby-node.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ exports.createPages = ({ graphql, actions }) => {
6262

6363
tags = _.uniq(tags)
6464
_.each(tags, tag => {
65-
const tagPath = `/tags/${_.kebabCase(tag)}/`
65+
const tagPath = `/blog/tags/${_.kebabCase(tag)}/`
6666
createPage({
6767
path: tagPath,
6868
component: tagTemplate,
@@ -77,7 +77,7 @@ exports.createPages = ({ graphql, actions }) => {
7777

7878
categories = _.uniq(categories)
7979
_.each(categories, category => {
80-
const categoryPath = `/categories/${_.kebabCase(category)}/`
80+
const categoryPath = `/blog/categories/${_.kebabCase(category)}/`
8181
createPage({
8282
path: categoryPath,
8383
component: categoryTemplate,
@@ -123,13 +123,13 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
123123

124124
if (node.frontmatter.tags) {
125125
const tagSlugs = node.frontmatter.tags.map(
126-
tag => `/tags/${_.kebabCase(tag)}/`
126+
tag => `/blog/tags/${_.kebabCase(tag)}/`
127127
)
128128
createNodeField({ node, name: 'tagSlugs', value: tagSlugs })
129129
}
130130

131131
if (typeof node.frontmatter.category !== 'undefined') {
132-
const categorySlug = `/categories/${_.kebabCase(
132+
const categorySlug = `/blog/categories/${_.kebabCase(
133133
node.frontmatter.category
134134
)}/`
135135
createNodeField({ node, name: 'categorySlug', value: categorySlug })

src/assets/fonts/fontello-1c73886c/css/fontello-embedded.css

-68
This file was deleted.
Binary file not shown.
Binary file not shown.

src/assets/fonts/fontello-1c73886c/config.json src/assets/fonts/fontello-41f8de9d/config.json

+12
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@
8989
"css": "stackoverflow",
9090
"code": 61804,
9191
"src": "fontawesome"
92+
},
93+
{
94+
"uid": "559647a6f430b3aeadbecd67194451dd",
95+
"css": "menu",
96+
"code": 61641,
97+
"src": "fontawesome"
98+
},
99+
{
100+
"uid": "9f7e588c66cfd6891f6f507cf6f6596b",
101+
"css": "phone",
102+
"code": 59393,
103+
"src": "fontawesome"
92104
}
93105
]
94106
}

src/assets/fonts/fontello-1c73886c/css/fontello-codes.css src/assets/fonts/fontello-41f8de9d/css/fontello-codes.css

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

22
.icon-mail:before { content: '\e800'; } /* '' */
3+
.icon-phone:before { content: '\e801'; } /* '' */
34
.icon-twitter:before { content: '\f099'; } /* '' */
45
.icon-github-circled:before { content: '\f09b'; } /* '' */
56
.icon-rss:before { content: '\f09e'; } /* '' */
7+
.icon-menu:before { content: '\f0c9'; } /* '' */
68
.icon-mail-alt:before { content: '\f0e0'; } /* '' */
79
.icon-linkedin:before { content: '\f0e1'; } /* '' */
810
.icon-rss-squared:before { content: '\f143'; } /* '' */

src/assets/fonts/fontello-41f8de9d/css/fontello-embedded.css

+70
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/fonts/fontello-1c73886c/css/fontello-ie7-codes.css src/assets/fonts/fontello-41f8de9d/css/fontello-ie7-codes.css

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

22
.icon-mail { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe800;&nbsp;'); }
3+
.icon-phone { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe801;&nbsp;'); }
34
.icon-twitter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf099;&nbsp;'); }
45
.icon-github-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf09b;&nbsp;'); }
56
.icon-rss { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf09e;&nbsp;'); }
7+
.icon-menu { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0c9;&nbsp;'); }
68
.icon-mail-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0e0;&nbsp;'); }
79
.icon-linkedin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0e1;&nbsp;'); }
810
.icon-rss-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf143;&nbsp;'); }

src/assets/fonts/fontello-1c73886c/css/fontello-ie7.css src/assets/fonts/fontello-41f8de9d/css/fontello-ie7.css

+2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
}
1212

1313
.icon-mail { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe800;&nbsp;'); }
14+
.icon-phone { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe801;&nbsp;'); }
1415
.icon-twitter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf099;&nbsp;'); }
1516
.icon-github-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf09b;&nbsp;'); }
1617
.icon-rss { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf09e;&nbsp;'); }
18+
.icon-menu { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0c9;&nbsp;'); }
1719
.icon-mail-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0e0;&nbsp;'); }
1820
.icon-linkedin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf0e1;&nbsp;'); }
1921
.icon-rss-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf143;&nbsp;'); }

src/assets/fonts/fontello-1c73886c/css/fontello.css src/assets/fonts/fontello-41f8de9d/css/fontello.css

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
@font-face {
22
font-family: 'fontello';
3-
src: url('../font/fontello.eot?80908021');
4-
src: url('../font/fontello.eot?80908021#iefix') format('embedded-opentype'),
5-
url('../font/fontello.woff2?80908021') format('woff2'),
6-
url('../font/fontello.woff?80908021') format('woff'),
7-
url('../font/fontello.ttf?80908021') format('truetype'),
8-
url('../font/fontello.svg?80908021#fontello') format('svg');
3+
src: url('../font/fontello.eot?8909629');
4+
src: url('../font/fontello.eot?8909629#iefix') format('embedded-opentype'),
5+
url('../font/fontello.woff2?8909629') format('woff2'),
6+
url('../font/fontello.woff?8909629') format('woff'),
7+
url('../font/fontello.ttf?8909629') format('truetype'),
8+
url('../font/fontello.svg?8909629#fontello') format('svg');
99
font-weight: normal;
1010
font-style: normal;
1111
}
@@ -15,7 +15,7 @@
1515
@media screen and (-webkit-min-device-pixel-ratio:0) {
1616
@font-face {
1717
font-family: 'fontello';
18-
src: url('../font/fontello.svg?80908021#fontello') format('svg');
18+
src: url('../font/fontello.svg?8909629#fontello') format('svg');
1919
}
2020
}
2121
*/
@@ -56,9 +56,11 @@
5656
}
5757

5858
.icon-mail:before { content: '\e800'; } /* '' */
59+
.icon-phone:before { content: '\e801'; } /* '' */
5960
.icon-twitter:before { content: '\f099'; } /* '' */
6061
.icon-github-circled:before { content: '\f09b'; } /* '' */
6162
.icon-rss:before { content: '\f09e'; } /* '' */
63+
.icon-menu:before { content: '\f0c9'; } /* '' */
6264
.icon-mail-alt:before { content: '\f0e0'; } /* '' */
6365
.icon-linkedin:before { content: '\f0e1'; } /* '' */
6466
.icon-rss-squared:before { content: '\f143'; } /* '' */

src/assets/fonts/fontello-1c73886c/demo.html src/assets/fonts/fontello-41f8de9d/demo.html

+12-10
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@
229229
}
230230
@font-face {
231231
font-family: 'fontello';
232-
src: url('./font/fontello.eot?91976658');
233-
src: url('./font/fontello.eot?91976658#iefix') format('embedded-opentype'),
234-
url('./font/fontello.woff?91976658') format('woff'),
235-
url('./font/fontello.ttf?91976658') format('truetype'),
236-
url('./font/fontello.svg?91976658#fontello') format('svg');
232+
src: url('./font/fontello.eot?31976447');
233+
src: url('./font/fontello.eot?31976447#iefix') format('embedded-opentype'),
234+
url('./font/fontello.woff?31976447') format('woff'),
235+
url('./font/fontello.ttf?31976447') format('truetype'),
236+
url('./font/fontello.svg?31976447#fontello') format('svg');
237237
font-weight: normal;
238238
font-style: normal;
239239
}
@@ -299,23 +299,25 @@ <h1>fontello <small>font demo</small></h1>
299299
<div class="container" id="icons">
300300
<div class="row">
301301
<div class="the-icons span3" title="Code: 0xe800"><i class="demo-icon icon-mail">&#xe800;</i> <span class="i-name">icon-mail</span><span class="i-code">0xe800</span></div>
302+
<div class="the-icons span3" title="Code: 0xe801"><i class="demo-icon icon-phone">&#xe801;</i> <span class="i-name">icon-phone</span><span class="i-code">0xe801</span></div>
302303
<div class="the-icons span3" title="Code: 0xf099"><i class="demo-icon icon-twitter">&#xf099;</i> <span class="i-name">icon-twitter</span><span class="i-code">0xf099</span></div>
303304
<div class="the-icons span3" title="Code: 0xf09b"><i class="demo-icon icon-github-circled">&#xf09b;</i> <span class="i-name">icon-github-circled</span><span class="i-code">0xf09b</span></div>
304-
<div class="the-icons span3" title="Code: 0xf09e"><i class="demo-icon icon-rss">&#xf09e;</i> <span class="i-name">icon-rss</span><span class="i-code">0xf09e</span></div>
305305
</div>
306306
<div class="row">
307+
<div class="the-icons span3" title="Code: 0xf09e"><i class="demo-icon icon-rss">&#xf09e;</i> <span class="i-name">icon-rss</span><span class="i-code">0xf09e</span></div>
308+
<div class="the-icons span3" title="Code: 0xf0c9"><i class="demo-icon icon-menu">&#xf0c9;</i> <span class="i-name">icon-menu</span><span class="i-code">0xf0c9</span></div>
307309
<div class="the-icons span3" title="Code: 0xf0e0"><i class="demo-icon icon-mail-alt">&#xf0e0;</i> <span class="i-name">icon-mail-alt</span><span class="i-code">0xf0e0</span></div>
308310
<div class="the-icons span3" title="Code: 0xf0e1"><i class="demo-icon icon-linkedin">&#xf0e1;</i> <span class="i-name">icon-linkedin</span><span class="i-code">0xf0e1</span></div>
309-
<div class="the-icons span3" title="Code: 0xf143"><i class="demo-icon icon-rss-squared">&#xf143;</i> <span class="i-name">icon-rss-squared</span><span class="i-code">0xf143</span></div>
310-
<div class="the-icons span3" title="Code: 0xf16c"><i class="demo-icon icon-stackoverflow">&#xf16c;</i> <span class="i-name">icon-stackoverflow</span><span class="i-code">0xf16c</span></div>
311311
</div>
312312
<div class="row">
313+
<div class="the-icons span3" title="Code: 0xf143"><i class="demo-icon icon-rss-squared">&#xf143;</i> <span class="i-name">icon-rss-squared</span><span class="i-code">0xf143</span></div>
314+
<div class="the-icons span3" title="Code: 0xf16c"><i class="demo-icon icon-stackoverflow">&#xf16c;</i> <span class="i-name">icon-stackoverflow</span><span class="i-code">0xf16c</span></div>
313315
<div class="the-icons span3" title="Code: 0xf16d"><i class="demo-icon icon-instagram">&#xf16d;</i> <span class="i-name">icon-instagram</span><span class="i-code">0xf16d</span></div>
314316
<div class="the-icons span3" title="Code: 0xf230"><i class="demo-icon icon-facebook-official">&#xf230;</i> <span class="i-name">icon-facebook-official</span><span class="i-code">0xf230</span></div>
315-
<div class="the-icons span3" title="Code: 0xf232"><i class="demo-icon icon-whatsapp">&#xf232;</i> <span class="i-name">icon-whatsapp</span><span class="i-code">0xf232</span></div>
316-
<div class="the-icons span3" title="Code: 0xf23a"><i class="demo-icon icon-medium">&#xf23a;</i> <span class="i-name">icon-medium</span><span class="i-code">0xf23a</span></div>
317317
</div>
318318
<div class="row">
319+
<div class="the-icons span3" title="Code: 0xf232"><i class="demo-icon icon-whatsapp">&#xf232;</i> <span class="i-name">icon-whatsapp</span><span class="i-code">0xf232</span></div>
320+
<div class="the-icons span3" title="Code: 0xf23a"><i class="demo-icon icon-medium">&#xf23a;</i> <span class="i-name">icon-medium</span><span class="i-code">0xf23a</span></div>
319321
<div class="the-icons span3" title="Code: 0xf308"><i class="demo-icon icon-facebook-squared">&#xf308;</i> <span class="i-name">icon-facebook-squared</span><span class="i-code">0xf308</span></div>
320322
<div class="the-icons span3" title="Code: 0xf30c"><i class="demo-icon icon-linkedin-squared">&#xf30c;</i> <span class="i-name">icon-linkedin-squared</span><span class="i-code">0xf30c</span></div>
321323
</div>

0 commit comments

Comments
 (0)