Skip to content

Instantly share code, notes, and snippets.

View Jamiewarb's full-sized avatar
🦑

Jamie Warburton Jamiewarb

🦑
View GitHub Profile
@Jamiewarb
Jamiewarb / BaseImage.vue
Created January 31, 2020 14:44
Drop in replacement for img tag with lazy loading (can add fade-in to it too, with a 10x10 WP image size and a CSS blur)
<!--Drop in replacement for img lazy loading-->
<!--Lazy load image replacement-->
<!--Fade in - Wordpress image size as 10x10 with CSS blur-->
<!--https://vuetensils.stegosource.com-->
<script>
const NAME = 'vts-img';
@Jamiewarb
Jamiewarb / BaseMedia.vue
Created January 7, 2020 10:13
Inuit Media Vue Component
<template>
<div :class="classes">
<div v-if="$slots.image" class="v-base-media__img">
<slot name="image" />
</div>
<div v-if="$slots.default" class="v-base-media__body">
<slot />
</div>
</div>
</template>
@Jamiewarb
Jamiewarb / BaseLayout.vue
Created January 7, 2020 10:11
Inuit Layout Vue Component
<template>
<div :class="layoutClasses"><slot /></div>
</template>
<script>
/**
* Base Layout - A grid-like layout system.
*
* A BaseLayout must only ever have BaseLayoutItem components as immediate children.
*
@Jamiewarb
Jamiewarb / WpLink.js
Last active December 2, 2019 18:00
Vue Link for Wuxt
@Jamiewarb
Jamiewarb / AcfImage.js
Last active November 26, 2019 11:23
ACF Image Object Components
import { getPreferredSizeFallbackOrder, getThemeSizes } from '~/utilities/wordpressHelpers';
export default class AcfImage {
constructor(imageObject) {
this.id = (imageObject.id ? imageObject.id : imageObject.ID) || null;
this.title = imageObject.title || null;
this.filename = imageObject.filename || null;
this.filesize = imageObject.filesize || null;
this.url = imageObject.url || null;
this.link = imageObject.link || null;
@Jamiewarb
Jamiewarb / BaseButton.vue
Last active April 13, 2022 18:49
Vue BaseButton component
<template>
<component
:is="tag"
:class="buttonClasses"
:type="nativeType"
v-bind="$attrs"
@click="$emit('click', $event)"
>
<span class="v-btn__slot"><slot /></span>
</component>
/**
* Triggers the sending of notifications for the processed form.
* Please refer to https://gist.github.com/keithdevon/08016bd065397c76045c
* for more information
*/
private function send_notifications( $form_id, $entry_id ) {
$form = \RGFormsModel::get_form_meta( $form_id );
$entry = \RGFormsModel::get_lead( $entry_id );
$notification_ids = [];
foreach( $form['notifications'] as $id => $info ){
<template>
<button :class="buttonClasses">
<slot />
</button>
</template>
<script>
const availableSizes = [null, 'tiny', 'small', 'large', 'huge'];
const availableThemes = ['white']; // 'dark', 'primary', 'secondary', 'tertiary'];
/**
@Jamiewarb
Jamiewarb / Stack.vue
Last active October 14, 2019 08:42
Vue Stack Primitive Object
<template>
<div :class="stackClasses" :data-identifier="configIdentifier">
<slot />
</div>
</template>
<script>
/**
* Flow elements require space to physically and conceptually separate them from the elements that come before and
* after them. This flow space should exist solely between children elements in a container, and not between an element
@Jamiewarb
Jamiewarb / BasePaymentForm.js
Last active September 11, 2019 16:31
FormTemplate.js
import BaseForm from './FormTemplate';
import { scaMixin } from '~/mixins/payments/scaMixin';
export default {
name: 'BasePaymentForm',
extends: BaseForm,
mixins: [scaMixin],
methods: {
async onSubmit() {
const response = this.submitForm();