Skip to content

Instantly share code, notes, and snippets.

View henrikwirth's full-sized avatar
✌️

Henrik Wirth henrikwirth

✌️
View GitHub Profile
@henrikwirth
henrikwirth / AcfComponents.js
Last active December 7, 2020 15:03
WPGraphQL ACF Flexible Layout mapping
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 March 18, 2020 01:07
Wrapper class around jsPDF to easily add block of text without having to position it by yourself.
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 August 7, 2019 16:31
Extending WP GraphQL images with gatsby-image functionality
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,