Skip to content

Instantly share code, notes, and snippets.

Avatar
✌️

Henrik Wirth henrikwirth

✌️
View GitHub Profile
@henrikwirth
henrikwirth / AcfComponents.js
Last active Dec 7, 2020
WPGraphQL ACF Flexible Layout mapping
View AcfComponents.js
import loadable from '@loadable/component';
const AcfComponents = {
Hero: loadable(() => import('../Hero/Hero')),
Grid: loadable(() => import('../Grid/Grid')),
};
export default AcfComponents;
@henrikwirth
henrikwirth / jsPDF-utils.js
Created Mar 18, 2020
Wrapper class around jsPDF to easily add block of text without having to position it by yourself.
View jsPDF-utils.js
export default class PDF {
constructor(name, { padding = [20, 25, 20, 25], width = 210, height = 297, defaultFontSize = 12, debug = false }) {
const jsPDF = require("jspdf")
require("jspdf-autotable")
this._name = name
this._width = width
this._height = height
this._padding = padding
this._defaultFontSize = defaultFontSize
@henrikwirth
henrikwirth / gatsby-node.js
Created Aug 7, 2019
Extending WP GraphQL images with gatsby-image functionality
View gatsby-node.js
const { createRemoteFileNode } = require(`gatsby-source-filesystem`)
// Note that WPGraphQL_MediaItem depends on your gatsby-source-graphql typeName which is set in the config
exports.createResolvers = ({
actions,
cache,
createNodeId,
createResolvers,
store,