Skip to content

Commit 2bffd57

Browse files
authored
Merge pull request #42 from eyalroth/dev
Merge dev to master
2 parents 410d568 + 7d21af5 commit 2bffd57

File tree

69 files changed

+1355
-929
lines changed

Some content is hidden

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

69 files changed

+1355
-929
lines changed

gatsby-browser.js

-144
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ 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-
118
export const onServiceWorkerUpdateReady = () => {
129
const answer = window.confirm(
1310
`This application has been updated. ` +
@@ -21,7 +18,6 @@ export const onServiceWorkerUpdateReady = () => {
2118

2219
export function onRouteUpdate({ location }) {
2320
addLittlefoot()
24-
addSidebarCollapse(location)
2521
}
2622

2723
function addLittlefoot() {
@@ -39,144 +35,4 @@ function addLittlefoot() {
3935
</button>
4036
`
4137
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-
}
18238
}

gatsby-node.js

+22-51
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,33 @@ const path = require('path')
44
const slash = require('slash')
55
const moment = require('moment')
66

7+
const menuLinks = require('./src/consts/menuLinks.jsx')
8+
79
exports.createPages = ({ graphql, actions }) => {
8-
const { createPage } = actions
10+
const { createPage, createRedirect } = actions
11+
const { CategoryLinks } = menuLinks
12+
13+
createRedirect({
14+
fromPath: '/blog',
15+
toPath: '/blog/software',
16+
redirectInBrowser: true,
17+
})
918

1019
return new Promise((resolve, reject) => {
1120
const postTemplate = path.resolve('./src/templates/PostTemplate/index.jsx')
1221
const pageTemplate = path.resolve('./src/templates/PageTemplate/index.jsx')
13-
const tagTemplate = path.resolve('./src/templates/TagTemplate/index.jsx')
14-
const categoryTemplate = path.resolve(
15-
'./src/templates/CategoryTemplate/index.jsx'
16-
)
22+
const postListTemplate = path.resolve('./src/templates/PostListTemplate/index.jsx')
23+
24+
_.each(CategoryLinks, categoryLink => {
25+
createPage({
26+
path: `/blog/${_.kebabCase(categoryLink.id)}`,
27+
component: postListTemplate,
28+
context: {
29+
categoryId: categoryLink.id,
30+
categoryLabel: categoryLink.label
31+
},
32+
})
33+
})
1734

1835
graphql(`
1936
{
@@ -27,9 +44,7 @@ exports.createPages = ({ graphql, actions }) => {
2744
slug
2845
}
2946
frontmatter {
30-
tags
3147
layout
32-
category
3348
}
3449
}
3550
}
@@ -54,36 +69,6 @@ exports.createPages = ({ graphql, actions }) => {
5469
component: slash(postTemplate),
5570
context: { slug: edge.node.fields.slug },
5671
})
57-
58-
let tags = []
59-
if (_.get(edge, 'node.frontmatter.tags')) {
60-
tags = tags.concat(edge.node.frontmatter.tags)
61-
}
62-
63-
tags = _.uniq(tags)
64-
_.each(tags, tag => {
65-
const tagPath = `/blog/tags/${_.kebabCase(tag)}/`
66-
createPage({
67-
path: tagPath,
68-
component: tagTemplate,
69-
context: { tag },
70-
})
71-
})
72-
73-
let categories = []
74-
if (_.get(edge, 'node.frontmatter.category')) {
75-
categories = categories.concat(edge.node.frontmatter.category)
76-
}
77-
78-
categories = _.uniq(categories)
79-
_.each(categories, category => {
80-
const categoryPath = `/blog/categories/${_.kebabCase(category)}/`
81-
createPage({
82-
path: categoryPath,
83-
component: categoryTemplate,
84-
context: { category },
85-
})
86-
})
8772
}
8873
})
8974

@@ -120,19 +105,5 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
120105
name: 'slug',
121106
value: slug,
122107
})
123-
124-
if (node.frontmatter.tags) {
125-
const tagSlugs = node.frontmatter.tags.map(
126-
tag => `/blog/tags/${_.kebabCase(tag)}/`
127-
)
128-
createNodeField({ node, name: 'tagSlugs', value: tagSlugs })
129-
}
130-
131-
if (typeof node.frontmatter.category !== 'undefined') {
132-
const categorySlug = `/blog/categories/${_.kebabCase(
133-
node.frontmatter.category
134-
)}/`
135-
createNodeField({ node, name: 'categorySlug', value: categorySlug })
136-
}
137108
}
138109
}

src/assets/fonts/fontello-41f8de9d/LICENSE.txt

-12
This file was deleted.

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

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

src/assets/fonts/fontello/LICENSE.txt

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Font license info
2+
3+
4+
## Font Awesome
5+
6+
Copyright (C) 2016 by Dave Gandy
7+
8+
Author: Dave Gandy
9+
License: SIL ()
10+
Homepage: http://fortawesome.github.com/Font-Awesome/
11+
12+
13+
## Elusive
14+
15+
Copyright (C) 2013 by Aristeides Stathopoulos
16+
17+
Author: Aristeides Stathopoulos
18+
License: SIL (http://scripts.sil.org/OFL)
19+
Homepage: http://aristeides.com/
20+
21+
22+
## Entypo
23+
24+
Copyright (C) 2012 by Daniel Bruce
25+
26+
Author: Daniel Bruce
27+
License: SIL (http://scripts.sil.org/OFL)
28+
Homepage: http://www.entypo.com
29+
30+
31+
## Linecons
32+
33+
Copyright (C) 2013 by Designmodo
34+
35+
Author: Designmodo for Smashing Magazine
36+
License: CC BY ()
37+
Homepage: http://designmodo.com/linecons-free/
38+
39+

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

+21-15
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@
4242
"code": 59392,
4343
"src": "fontawesome"
4444
},
45-
{
46-
"uid": "ccc2329632396dc096bb638d4b46fb98",
47-
"css": "mail-alt",
48-
"code": 61664,
49-
"src": "fontawesome"
50-
},
5145
{
5246
"uid": "bf09b1c6561dc0ced707476e2cd83d29",
5347
"css": "medium",
@@ -78,12 +72,6 @@
7872
"code": 61598,
7973
"src": "fontawesome"
8074
},
81-
{
82-
"uid": "de5f0a564ccf8816325330e292e11533",
83-
"css": "rss-squared",
84-
"code": 61763,
85-
"src": "fontawesome"
86-
},
8775
{
8876
"uid": "e1597911f34fea0a188ae51fe4a2d9a9",
8977
"css": "stackoverflow",
@@ -97,10 +85,28 @@
9785
"src": "fontawesome"
9886
},
9987
{
100-
"uid": "9f7e588c66cfd6891f6f507cf6f6596b",
101-
"css": "phone",
102-
"code": 59393,
88+
"uid": "7e4164950ffa4990961958b2d6318658",
89+
"css": "info-circled",
90+
"code": 59394,
91+
"src": "entypo"
92+
},
93+
{
94+
"uid": "0133387f2069a1b3168942b84d81dd3a",
95+
"css": "gamepad",
96+
"code": 61723,
10397
"src": "fontawesome"
98+
},
99+
{
100+
"uid": "e36d581e4f2844db345bddc205d15dda",
101+
"css": "group",
102+
"code": 59393,
103+
"src": "elusive"
104+
},
105+
{
106+
"uid": "52cde78d270e411ccf22c9ec02910d69",
107+
"css": "cd",
108+
"code": 59396,
109+
"src": "linecons"
104110
}
105111
]
106112
}

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11

22
.icon-mail:before { content: '\e800'; } /* '' */
3-
.icon-phone:before { content: '\e801'; } /* '' */
3+
.icon-group:before { content: '\e801'; } /* '' */
4+
.icon-info-circled:before { content: '\e802'; } /* '' */
5+
.icon-cd:before { content: '\e804'; } /* '' */
46
.icon-twitter:before { content: '\f099'; } /* '' */
57
.icon-github-circled:before { content: '\f09b'; } /* '' */
68
.icon-rss:before { content: '\f09e'; } /* '' */
79
.icon-menu:before { content: '\f0c9'; } /* '' */
8-
.icon-mail-alt:before { content: '\f0e0'; } /* '' */
910
.icon-linkedin:before { content: '\f0e1'; } /* '' */
10-
.icon-rss-squared:before { content: '\f143'; } /* '' */
11+
.icon-gamepad:before { content: '\f11b'; } /* '' */
1112
.icon-stackoverflow:before { content: '\f16c'; } /* '' */
1213
.icon-instagram:before { content: '\f16d'; } /* '' */
1314
.icon-facebook-official:before { content: '\f230'; } /* '' */

0 commit comments

Comments
 (0)