Skip to content

Commit 0151943

Browse files
authored
Merge pull request #2 from draftbox-co/user-customization
Merge User customization
2 parents 86555b3 + 0ddac8e commit 0151943

26 files changed

+1185
-423
lines changed

example/.env.development

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
DISQUS_SHORTNAME=
2-
FORM_URL=http://localhost:3000/api/project/5e81b8923d8c2d64d8549add/forms
1+
GATSBY_DISQUS_SHORTNAME=built-with-draftbox
2+
GATSBY_FORM_URL=http://localhost:3000/api/project/5e81b8923d8c2d64d8549add/forms
33
GATSBY_FB_APP_ID=

example/.env.production

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
DISQUS_SHORTNAME=
2-
FORM_URL=http://localhost:3000/api/project/5e81b8923d8c2d64d8549add/forms
3-
FB_APP_ID=
1+
GATSBY_DISQUS_SHORTNAME=built-with-draftbox
2+
GATSBY_FORM_URL=http://localhost:3000/api/project/5e81b8923d8c2d64d8549add/forms
3+
GATSBY_FB_APP_ID=

example/site-config.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
themeColor: "#15171A", // Used for Offline Manifest
1717
apiUrl: "https://wordpress.theasdfghjkl.com",
1818
subscribeWidget: {
19+
visible: true,
1920
title: "Subscribe to Draftbox",
2021
helpText: "Get the latest posts delivered right to your inbox.",
2122
successMessage: "Thanks for subscribing to Draftbox.",
@@ -63,6 +64,12 @@ module.exports = {
6364
instagram: "https://www.instagram.com/",
6465
linkedin: "https://linkedin.com/",
6566
github: "https://github.com/draftbox-co",
67+
whatsapp: "",
68+
pinterest: "",
69+
youtube: "",
70+
dribbble: "",
71+
behance: "",
72+
externalLink: "",
6673
},
6774
contactWidget: {
6875
title: "Contact Built with Draftbox",
@@ -95,4 +102,59 @@ module.exports = {
95102
iconUrl: "favicon.png",
96103
coverUrl: "cover.jpg",
97104
alternateLogoUrl: "logo.png",
105+
themeConfig: {
106+
fonts: [
107+
{
108+
family: "Libre Baskerville",
109+
variants: ["400", "700"],
110+
fontDisplay: "swap",
111+
strategy: "selfHosted",
112+
},
113+
{
114+
family: "Source Code Pro",
115+
variants: ["400", "700"],
116+
fontDisplay: "swap",
117+
strategy: "selfHosted",
118+
},
119+
],
120+
variables: [
121+
{
122+
varName: "--page-background",
123+
value: "#ede6dd",
124+
},
125+
{
126+
varName: "--primary-font",
127+
value: "Libre Baskerville",
128+
},
129+
{
130+
varName: "--primary-font-normal",
131+
value: "400",
132+
},
133+
{
134+
varName: "--primary-font-bold",
135+
value: "700",
136+
},
137+
{
138+
varName: "--primary-color",
139+
value: "#438d8d",
140+
},
141+
{
142+
varName: "--secondary-font",
143+
value: "Source Code Pro",
144+
},
145+
{
146+
varName: "--secondary-font-normal",
147+
value: "400",
148+
},
149+
{
150+
varName: "--secondary-font-bold",
151+
value: "700",
152+
},
153+
{
154+
varName: "--secondary-color",
155+
value: "#5e4f40",
156+
},
157+
158+
],
159+
},
98160
};

gatsby-wordpress-theme-libre/gatsby-browser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ let injected = false;
5656
let injectedTwitterScript = false;
5757

5858
export const onRouteUpdate = ({ location: { hash } }) => {
59+
5960
if (hash) {
6061
window.setTimeout(scrollTo(hash), 10);
6162
}

gatsby-wordpress-theme-libre/gatsby-config.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = (themeOptions) => {
1313
const siteConfig = themeOptions.siteConfig || siteConfigDefaults;
1414
const wordpressConfig = themeOptions.wordpressConfig;
1515

16-
return {
16+
const configOptions = {
1717
siteMetadata: siteConfig,
1818
plugins: [
1919
/**
@@ -30,6 +30,13 @@ module.exports = (themeOptions) => {
3030
name: `pages`,
3131
},
3232
},
33+
{
34+
resolve: `gatsby-source-filesystem`,
35+
options: {
36+
path: path.join(__dirname, `static`),
37+
name: `static`,
38+
},
39+
},
3340
// Setup for optimized images.
3441
// See https://www.gatsbyjs.org/packages/gatsby-image/
3542
{
@@ -88,8 +95,8 @@ module.exports = (themeOptions) => {
8895
`/404`,
8996
`/404.html`,
9097
`/offline-plugin-app-shell-fallback`,
91-
'/offline',
92-
'/offline.html'
98+
"/offline",
99+
"/offline.html",
93100
],
94101
createLinkInHead: true,
95102
addUncaughtPages: true,
@@ -176,6 +183,30 @@ module.exports = (themeOptions) => {
176183
content: `Draftbox`,
177184
},
178185
},
186+
{
187+
resolve: `@draftbox-co/gatsby-plugin-css-variables`,
188+
options: {
189+
variables: siteConfig.themeConfig.variables,
190+
},
191+
},
179192
],
180193
};
194+
195+
if (siteConfig.themeConfig.fonts && siteConfig.themeConfig.fonts.length > 0) {
196+
configOptions.plugins.push({
197+
resolve: `@draftbox-co/gatsby-plugin-webfonts`,
198+
options: {
199+
fonts: {
200+
google: siteConfig.themeConfig.fonts,
201+
},
202+
formats: ["woff2", "woff"],
203+
useMinify: true,
204+
usePreload: true,
205+
usePreconnect: true,
206+
blacklist: ["/amp"],
207+
},
208+
});
209+
}
210+
211+
return configOptions;
181212
};

gatsby-wordpress-theme-libre/gatsby-node.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
255255
siteMetadata {
256256
postsPerPage
257257
siteTitle
258+
subscribeWidget {
259+
visible
260+
}
258261
}
259262
}
260263
@@ -276,6 +279,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
276279
const tags = result.data.allWordpressTag.edges;
277280
const pages = result.data.allWordpressPage.edges;
278281
const siteTitle = result.data.site.siteMetadata.siteTitle;
282+
const subscribeWidget = result.data.site.siteMetadata.subscribeWidget;
279283

280284
posts.forEach((post, i, arr) => {
281285
createPage({
@@ -285,6 +289,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
285289
slug: post.node.slug,
286290
next: i === arr.length - 1 ? null : arr[i + 1].node.id,
287291
prev: i !== 0 ? arr[i - 1].node.id : null,
292+
subscribeWidget: subscribeWidget,
288293
},
289294
});
290295

@@ -327,6 +332,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
327332
component: pageTemplate,
328333
context: {
329334
slug: page.node.slug,
335+
subscribeWidget: subscribeWidget,
330336
},
331337
});
332338
});

gatsby-wordpress-theme-libre/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
},
4848
"dependencies": {
4949
"@draftbox-co/gatsby-plugin-amp": "^0.2.4",
50+
"@draftbox-co/gatsby-plugin-css-variables": "^0.0.3",
51+
"@draftbox-co/gatsby-plugin-webfonts": "^1.1.3",
5052
"@reach/router": "^1.3.3",
5153
"disqus-react": "^1.0.8",
5254
"gatsby-awesome-pagination": "^0.3.5",

0 commit comments

Comments
 (0)