This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import styles from './modal.module.scss'; | |
import { generateClassList } from './helpers'; // https://gist.github.com/tomfordweb/cb13de2f6d780f296141b6e4a406e6c7 | |
const Modal = ({ handleClose, show, children, className, }) => { | |
const showHideClassName = show ? styles.displayBlock : styles.displayNone; | |
return ( | |
<div className={generateClassList(styles.modal, showHideClassName, className)}> | |
<section className={styles.main}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import React from 'react'; | |
import update from 'immutability-helper'; | |
export default class Expire extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
delay: props.delay || 1000, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import update from 'immutability-helper'; | |
export default class HideIfClickedOutside extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Non-destructive chunk method for arrays | |
*/ | |
export const chunk = (array, chunk) => { | |
var i, j, temparray = []; | |
for (i = 0, j = array.length; i < j; i += chunk) { | |
temparray.push(array.slice(i, i + chunk)); | |
// do whatever | |
} | |
return temparray; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_email_headers', 'tfw_wooc_order_multiple_recipients', 10, 2); | |
function tfw_wooc_order_multiple_recipients( $headers = '', $id = '') { | |
$order_statuses = array( | |
'new_order', | |
'cancelled_order', | |
'customer_processing_order', | |
'customer_invoice', | |
'customer_refunded_order', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import React from 'react'; | |
import update from 'immutability-helper'; | |
export default class HideIfClickedOutside extends React.Component { | |
constructor(props) { | |
super(props); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import update from 'immutability-helper'; | |
export default class Expire extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
delay: props.delay || 1000, | |
visible: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin flex-content() { | |
display: flex; | |
justify-content: space-between; | |
align-content: space-between; | |
flex-flow: row wrap; | |
align-items: baseline; | |
& > * { // all 1st gen children of flex-content should be inline-block | |
display: inline-block | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// handles hover for images | |
$('.home .callout').hover(function() { | |
// hover in | |
$(this).find('img').attr('src', function(index, attr) { | |
// foo1.png -> foo2.png | |
return attr.replace('1.png','2.png'); | |
}); | |
}, function() { | |
// hover out | |
$(this).find('img').attr('src', function(index, attr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pass an object of attributes and their values and the element to modify | |
* @param {object} attributes Key-value pairs consisting of the attribute, and it's value | |
* @param {DOM Elem} element A queried or generated dom element | |
*/ | |
function addAttributesToElement(attributes, element) { | |
for(var key in attributes) { | |
if (attributes.hasOwnProperty(key)) { | |
var attrKey = document.createAttribute(key); |